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

Why does the character move away from the block?

I made a script that's supposed to put you inside a part but when you touch it you are flung away a few studs before being welded. I think it might have to do with the cancollide being true but I want players to be able to push the brick around. Here's the script: debounce = true

function onTouch(h)
	if h.Parent:FindFirstChild("Humanoid") then
		h.Parent:MoveTo(script.Parent.Position)
		h.Parent.Torso.CFrame = script.Parent.CFrame
		local weld = Instance.new("Weld")
		weld.Parent = script.Parent
		weld.Part0 = h.Parent.Torso
		weld.C0 = h.Parent.Torso.CFrame:inverse()
		weld.Part1 = script.Parent
		weld.C1 = script.Parent.CFrame
		script.Parent.Anchored = false
	end
end

script.Parent.Touched:connect(onTouch)

1 answer

Maybe try the anchoring the torso before changing its position to the block and then unanchor it after welding it to the block.

1 comment

0

kinda works but as soon as torso is unanchored it happens again

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