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

Basic VR grabbing script doesn't work. Fix?

Asked by 3 years ago

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.

0
try debugging the script first to see any potential issues RazzyPlayz 497 — 3y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

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)
Ad

Answer this question