Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CollectionService = game:GetService("CollectionService")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Debris = game:GetService("Debris")
- local TweenService = game:GetService("TweenService")
- local RunService = game:GetService("RunService")
- local Quire = require(ReplicatedStorage.Quire)
- local QUtil = Quire.GetModule("QUtil")
- local isServer = RunService:IsServer()
- local isClient = RunService:IsClient()
- local effectEvent = QUtil.GetRemoteEvent("EffectEvent")
- local effects = ReplicatedStorage.Effects
- local sounds = effects.Sounds
- local EffectsManager= {}
- function EffectsManager.Shockwave(effectParams)
- local position = effectParams.Position or Vector3.new(0, 0, 0)
- local startSize = effectParams.StartSize or Vector3.new(0, 0, 0)
- local endSize = effectParams.EndSize or Vector3.new(5, 5, 5)
- local duration = effectParams.Duration or 1
- local startTransparency = effectParams.StartTransparency or 0
- local endTransparency = effectParams.EndTransparency or 1
- local shockwaveType = effectParams.ShockWaveType or "Shockwave8Side"
- local possibleRotations = {-90, 90, -180, 180}
- local randomRotationEnd = possibleRotations[math.random(#possibleRotations)]
- local shockwave = effects[shockwaveType]:Clone()
- shockwave.Transparency = startTransparency
- shockwave.CFrame = CFrame.new(position + Vector3.new(0, startSize.Y/2, 0))
- shockwave.Size = startSize
- shockwave.Parent = workspace.Ignore
- local waveTweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
- local waveTween = TweenService:Create(shockwave, waveTweenInfo, {
- Size = endSize,
- CFrame = CFrame.new(position + Vector3.new(0, endSize.Y/2, 0)) * CFrame.Angles(0, math.rad(randomRotationEnd), 0)
- }):Play()
- local transparencyTweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
- local transparencyTween = TweenService:Create(shockwave, transparencyTweenInfo, {
- Transparency = endTransparency
- }):Play()
- Debris:AddItem(shockwave, duration)
- end
- function EffectsManager.LocationSound(audioName, position, maxDistance, volume)
- local soundAttachment = Instance.new("Attachment")
- soundAttachment.WorldPosition = position
- soundAttachment.Parent = workspace.Baseplate
- local sound = sounds[audioName]:Clone()
- sound.Volume = volume
- sound.MaxDistance = maxDistance or sound.MaxDistance
- sound.Parent = soundAttachment
- soundAttachment:Destroy()
- end
- function EffectsManager.VisualizeWaypoints(waypoints, lifespan)
- for i = 1, #waypoints do
- local waypoint = waypoints[i]
- local waypointPart = effects.Waypoint:Clone()
- waypointPart.BrickColor = (i == 1 and BrickColor.Green()) or (i == #waypoints and BrickColor.Red()) or BrickColor.new("White")
- waypointPart.Position = waypoint.Position
- waypointPart.Parent = workspace.Ignore
- Debris:AddItem(waypointPart, lifespan)
- end
- end
- function EffectsManager.Hitmarker(part, number, duration)
- local hitmarker = effects.HitMarker:Clone()
- hitmarker.TextLabel.Text = tostring(math.floor(number)) .. "!"
- hitmarker.Adornee = part
- hitmarker.Parent = game.Players.LocalPlayer.PlayerGui
- local hitmarkerTweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Exponential, Enum.EasingDirection.In)
- local hitmarkerTweenInfo2 = TweenInfo.new(duration, Enum.EasingStyle.Exponential, Enum.EasingDirection.In)
- TweenService:Create(hitmarker, hitmarkerTweenInfo, {
- SizeOffset = Vector2.new(0, 3.5)
- }):Play()
- TweenService:Create(hitmarker.TextLabel, hitmarkerTweenInfo2, {
- TextTransparency = 1,
- TextStrokeTransparency = 1
- }):Play()
- Debris:AddItem(hitmarker, duration)
- end
- function EffectsManager.CastEffectToAll(...)
- effectEvent:FireAllClients(...)
- end
- if isClient then
- effectEvent.OnClientEvent:Connect(function(effectName, ...)
- EffectsManager[effectName](...)
- end)
- end
- return EffectsManager
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement