Hello. I got hitbox part for my projectile. I need to move this part with the mouse... I can do it in local script, but when it comes to script, it won't work. Yes, you can fire event, but after firing event it will get last mouse position and it won't update mouse position, you can also fire it multiple times, but this projectile is supposed to be used 1 time in 40 seconds. Any thoughts on how could I move part with mouse through normal script?

local part = Instance.new("Part")

part.Parent = Player.Character

part.Name = "SBZB"

local r = Instance.new("RocketPropulsion",part)

part.CanCollide = false

part.Anchored = true

game.Debris:AddItem(part,60)

local particleboom = game.ReplicatedStorage.ARandomizer.Senbonzakura.LeafExplosion:Clone()

particleboom.Rate = 300

particleboom.Lifetime = NumberRange.new(6)

particleboom.Parent = part

game.Debris:AddItem(particleboom,60)

part.Size = Vector3.new(15,15,15)

part.Transparency = 1

Player.Character.SBZB.RocketPropulsion:Fire()

coroutine.wrap(function()

while charging and wait() do

part.Position = mousepos

Player.Character.SBZB.RocketPropulsion.Target = part

end

end)()

1 comment

0

http://xyproblem.info also don't call wait with no args or a small number, and not in the condition of the while loop.