I made a tool that is supposed to be like a spiderman web swing, and I made the script create a rope constraint between two parts. When I used it, nothing happened. I found out the handle disappeared the second the game opened, and there is no error at all even though the local script requires a handle. Other tools' handles are not being removed, and I have tried messing with the tool and checking my script to see if it accidentally deleted the handle. If it helps, here is my script:

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local webOut = false

tool.Equipped:Connect(function(mouse)
	print("Web Equipped!")
	
	mouse.Button1Down:connect(function()
		if not webOut then
			print("Mouse pressed!")
			webOut = true
			
			local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
			local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
			
			attachment1 = Instance.new("Attachment")
			attachment1.Parent = part
			attachment2 = Instance.new("Attachment")
			attachment2.Parent = tool.Handle
			
			rope = Instance.new("RopeConstraint")
			rope.Parent = tool
			rope.Attachment0 = attachment1
			rope.Attachment1 = attachment2
		else 
			webOut = false
			rope:Destroy()
			attachment1:Destroy()
			attachment2:Destroy()
		end
	end)
end)

there are no other scripts at all in the workspace and no free models.

3 comments

0

did u weld the handle with the other parts together

0

there is one part

0

that one part is the handle