I’m making a script in which when a proximity prompt is activated (It’s a local script), and when the remote event is activated, a rope is created that has attachments connected to the cart and the player. The script prints nothing though, and I’m not sure what to do. There are no errors either, so I’m stuck right now.
local pp = script.Parent
local RS = game:GetService("ReplicatedStorage")
local AttatchRope = RS:WaitForChild("Remotes"):WaitForChild("AttatchRopeToTransport")
local DetatchRope = RS:WaitForChild("Remotes"):WaitForChild("DetatchRopeToTransport")
local clicked = 0
local cooldown = false
pp.Triggered:Connect(function(player)
print(pp.Parent:GetAttribute("Ownership"))
print(player.Name == pp.Parent:GetAttribute("Ownership"))
if player.Name == pp.Parent:GetAttribute("Ownership") and clicked == 0 then
if not cooldown then cooldown = true elseif cooldown then return end
local transportVehicle = pp.Parent.Parent
clicked += 1
AttatchRope:FireServer(player, transportVehicle)
task.wait(.558)
cooldown = false
elseif player.Name == pp.Parent:GetAttribute("Ownership") and clicked == 1 then
if not cooldown then cooldown = true elseif cooldown then return end
local transport = pp.Parent.Parent
clicked -= 1
DetatchRope:FireServer(player, transport)
task.wait(.558)
cooldown = false
end
end)
local RS = game:GetService("ReplicatedStorage")
local AttatchRope = RS:WaitForChild("Remotes"):WaitForChild("AttatchRopeToTransport")
local DetatchRope = RS:WaitForChild("Remotes"):WaitForChild("DetatchRopeToTransport")
AttatchRope.OnServerEvent:Connect(function(player, transporter)
local playerChar = player.Character
local RightArm = playerChar:FindFirstChild("Right Arm")
local Rope = Instance.new("RopeConstraint", RightArm)
Rope.Name = "Rope"
Rope.Attachment0 = Instance.new("Attachment", RightArm)
Rope.Attachment0.Name = "RopeConstraintAttatchment"
Rope.Attachment1 = Instance.new("Attachment", transporter:WaitForChild("RopePart"))
Rope.Attachment1.Name = "RopeConstraintAttatchment"
end)
DetatchRope.OnServerEvent:Connect(function(player, transporter)
local playerChar = player.Character
local RightArm = playerChar:FindFirstChild("Right Arm")
local Rope = RightArm:WaitForChild("Rope")
Rope.Attatchment0:Destroy()
Rope.Attatchment1:Destroy()
Rope:Destroy()
end)