Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

The cloned part doesn't move?

Im trying to create a shockwave effect, and have it launch over to where the mouse is facing. But the cloned part(Shockwave part) stays where my HumanoidRootPart is, and it only increases in size. I couldn't figure out how to fix this issue:

local event = script.Parent:WaitForChild("MoveQEvent")

event.OnServerEvent:Connect(function(player, mouse, HRP)
	print(mouse)
	print(HRP)
	local rep = game:GetService("ReplicatedStorage")
	local shock = rep:WaitForChild("Shockwave")
	local clone = shock:Clone()
	clone.Parent = game.Workspace
	clone.Position = HRP.Position
	local BV = Instance.new("BodyVelocity", clone)
	BV.MaxForce = Vector3.new(1e8,1e8,1e8)
	BV.Velocity = (mouse - HRP.Position)*500
	clone.CFrame = CFrame.new(clone.Position, mouse)
	game:GetService("TweenService"):Create(clone, TweenInfo.new(10), {Size = Vector3.new(100,1,100)}):Play() 
end)

mouse = mouse.Hit.p and The shockwave part is a MeshPart

1 answer

✓ Accepted answer

Since this is a cloned part, one of the possible reasons behind this is the fact that the part might be anchored, since you never unanchor it anywhere in the script. BodyVelocity doesn't work on anchored parts, and as a result, it won't move it.

1 comment

0

thanks! i unanchored the part in the script and it worked.

This discussion is preserved as it was. New answers, comments, and votes are closed.