I’m making a tool that’s basically a grappling hook, I’m using a rope to attach the player, But whenever I use the tool and it grapples, It’s about 20 studs from where I clicked, This is being run from a local script inside a tool.
No output but my print.
Also, The Position of the Attatchment is the same as the WorldPosition.
Video of the error:
Script:
local Att = script.Parent.Web.Attachment1
local Tool = script.Parent
local Shot = false
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
function Shoot()
local Att2 = Instance.new("Attachment")
local Web = script.Parent.Web.Web
if Shot == false then
local Pos = mouse.Hit.Position
Att2.WorldPosition = Pos
Att2.Parent = mouse.Target
print(Att2.Parent)
wait()
Web.Attachment0 = Att
Web.Attachment1 = Att2
Shot = true
Web.Visible = true
elseif Shot == true then
Shot = false
Web.Visible = false
Web.Attachment1:Destroy()
end
end
Tool.Activated:Connect(Shoot)
That’s fine… I was pretty bad too for a long time. In studio you can select text and press Tab to indent it. Shift+Tab will unindent the selected text. Also I couldn’t watch the video since I’m on service (and it’s super slow where I’m at right now) but it did load. Does the attachment appear at the correct location when you select it?
To summarize the video, I click on a part, And the rope is about 10 studs away from the part I clicked, Also, The attachment is in the wrong place.
Like I mentioned, The Position (local to the part it’s parented to) Is the same as the
WorldPosition (the position where the attachment is actually in the world.)
Basically, I just created a new part and put that on Mouse.Hit.Position,Then parented the part to Att2 (the attatchment that was causing issues) Bit of a pieced together solution, But all in all it worked.