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

How do I attach a new rope cronstraint to a tool handle?

Asked by 3 years ago
Edited 3 years ago

So I was trying to make a fishing simulator game. I tried making it so a rope appeared when I clicked with a tool, it all worked well until I got to the rope instance part of the code, it does not attach to my handle and it doesn't even appear in my world, this is my code:

tool = script.Parent

handle = tool:WaitForChild("Handle")

tool.Activated:Connect(function()
    local newRope = Instance.new("RopeConstraint",game.StarterPack["Basic rod"])
    newRope.Attachment0 = handle
    print("Hello world!")
end)

and this is my error messages:

13:06:05.416 Expected Attachment got Tool for RopeConstraint:Attachment0. - Server - Script:7

13:06:05.416 Stack Begin - Studio

13:06:05.417 Script 'Players.Anderssc.Backpack.Basic rod.Script', Line 7 - Studio - Script:7

13:06:05.417 Stack End - Studio

Please help me so that I can keep on going

1 answer

Log in to vote
0
Answered by 3 years ago

Attachment0 expects an Attachment instance, not a part. To fix this, you can insert an Attachment into the Handle and path to it.

Also, you are parenting the RopeConstraint to the took in StarterPack. You should parent it to the tool in the Backpack.

Ad

Answer this question