So what’s happening is I cant actually get my script to function correctly. I’m making a basic spell for my game and this requires me to clone an object. Yet for some reason after I’ve cast the spell once it doesn’t fire.
Yes, I’ve made sure that nothing is deleting or destroying it. The only thing which I can think of which would cause this error would be the line which sends the energy ball to the workspace.
Attempts to fix it
I’ve tried indenting anything which would cause this error and tried disabling some other scripts. Yet nothing seems to work.
local Tool = script.Parent.Parent.Parent local play = Tool.Parent local char = play.Character local hum = char.Humanoid local root = char.HumanoidRootPart local cooldown = false local CDTime = 4 local Damage = 25 script.Parent.Parent.RemoteEvent.OnServerEvent:Connect(function(player, Mouse) if cooldown then return end local LightningPulse = script.LightningPulse:Clone() local Character = game.Workspace[player.Name] LightningPulse.CFrame = CFrame.new(Character.Head.CFrame.p, Mouse.p) + CFrame.new(Character.Head.CFrame.p, Mouse.p).lookVector * 3 local BodyVelocity = Instance.new("BodyVelocity") BodyVelocity.Velocity = LightningPulse.CFrame.lookVector * 125 BodyVelocity.MaxForce = Vector3.new(1e6,1e6,1e6) BodyVelocity.Parent = LightningPulse LightningPulse.Parent = game.Workspace LightningPulse.Script.Disabled = false LightningPulse.Damage.Disabled = false LightningPulse.Player.Value = player.Name cooldown = true wait(CDTime) cooldown = false end)
I’m still working on some aspects of it so it may not be the best. Is there anyway I can fix it. I have no idea what’s going wrong.