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

Basic VR grabbing script doesn't work. Fix?

I'm trying to make a block that when the hand touches it, it anchors the block, and then it sets the CFrame of that block to the hand.

script.Parent.Touched:Connect(function(hit)

	if hit.Name == "LeftHand" or hit.Name == "RightHand" then

		script.Parent.Anchored = true

		while true do

			script.Parent.CFrame = hit.CFrame
			wait(0.1)

		end

	end

end)

I do not get any errors.

1 comment

0

try debugging the script first to see any potential issues

1 answer

Use script.Parent.Position.CFrame, not script.Parent.CFrame

Edit:

If it doesn't work, you can use this:

script.Parent.Position = Vector3.new(hit.Position.X, hit.Position.Y, hit.Position.Z)

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