Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

projectile inherits velocity of previous clone?

Asked by 4 years ago
cd = 0
local debounce = false


script.Parent.UseWand.OnServerEvent:Connect(function(Player)
    if cd == 0 then
        cd = 1
        local Bolt = game.ReplicatedStorage.bolt:Clone()
        Bolt.CFrame = script.Parent.Parent.Handle.CFrame*CFrame.new(0,1,-10)        
        Bolt.Parent = workspace
        Bolt.Velocity = script.Parent.Parent.Handle.CFrame.lookVector * 20
        game.ReplicatedStorage.bolt.BodyVelocity.Velocity =         script.Parent.Parent.Handle.CFrame.lookVector*40*2
        script.Parent.Parent.Handle.Sound:Play()
        wait(0.6)
        cd = 0
        end
    end)

whenever the local script fires the server, it creates a projectile, but lookvector doesn't update and every projectile inherits the velocity of the previous one, resulting in the first bolt i fire when i change direction to be in my previous lookvector and then working as intended

Answer this question