Why is my weapon not shooting when I moved?
Asked by
4 years ago Edited 4 years ago
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:
01 | script.Parent.Activated:Connect( function (plr) |
02 | local magic = game.ServerStorage:WaitForChild( "Magic" ) |
03 | local NewMagic = magic:Clone() |
04 | NewMagic.Parent = script.Parent |
05 | NewMagic.CFrame = script.Parent.Core.CFrame |
07 | local velocity = Instance.new( "BodyVelocity" ) |
08 | velocity.Parent = NewMagic |
09 | velocity.MaxForce = Vector 3. new( 4000 , 4000 , 4000 ) |
10 | NewMagic.CFrame = script.Parent.Core.CFrame |
11 | velocity.Velocity = (NewMagic.Parent.Core.CFrame.lookVector* 100 ) |
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.