Hi, I'm making a magic staff. The problem is when I stand still, it shoots but when I moved, it doesn't and sometimes it shoot down. I have tried anchored the magic but then when I clicked, the magic only spawn and it didn't move. It would be great if you can help me fix my script and I also need to make a cool down for my weapon but I don't know how. This is my script:
script.Parent.Activated:Connect(function(plr) local magic = game.ServerStorage:WaitForChild("Magic") local NewMagic = magic:Clone() NewMagic.Parent = script.Parent NewMagic.CFrame = script.Parent.Core.CFrame local velocity = Instance.new("BodyVelocity") velocity.Parent = NewMagic velocity.MaxForce = Vector3.new(4000,4000,4000) NewMagic.CFrame = script.Parent.Core.CFrame velocity.Velocity = (NewMagic.Parent.Core.CFrame.lookVector*100) wait(0.5) NewMagic:Destroy() end)
I placed this script in the tool, the 'Core' is a part of my weapon, it is where I want my weapon to spawn the magic and shoot it from there. I had customized the magic and put it into the ServerStorage. This weapon only shoots forward, I don't know how to make it move to the point where I clicked at so it would also be great if you can help me with this.
For they cool down i think you should probably use a debounce there are a lot of videos on it on youtube :)