Proximity prompt issue

So im trying to make a rope that welds u to it when you trigger the proximity prompt, it is 2 seconds long. Problem is, it creates 2 welds instead of 1? But why?

local script:

local remote = game:GetService("ReplicatedStorage"):FindFirstChild("weldcreate")
local plr = game:GetService("Players").LocalPlayer

remote.OnClientEvent:Connect(function(player)
	local welds = Instance.new("Weld", game.Workspace)
	local character = plr.Character
	if character:FindFirstChild("HumanoidRootPart") then
		print("Found")
		welds.Part0 = game.Workspace.Model:FindFirstChild("4")
		welds.Part1 = character.HumanoidRootPart
	else
		print("No HRP")
	end
end)

server script:


local remote = game.ReplicatedStorage.weldcreate
script.Parent.Triggered:Connect(function(plr)
	remote:FireClient(plr)
print(plr)

end)

This is kinda annoying, if anyone can help please do. also if u have advice for the rope let me know

1 Like

Check documentation to see if “triggered” fires multiple times (maybe once on press and once on release)

Make sure you don’t have multiple scripts that fire/receive the remoteEvent.

also, you don’t need the player argument as you’re in a local script.

oh and try printing something after the remote is received to see how many times it got received.

on the local script “found” is printed twice. alright i removed player argument even tho it wont fix it. also nope, multiple scripts arent firing/receiving it :sob:

where did you parent your localscript?

i added your scripts to my game to test it out and it doesn’t print twice to me, which means you’re firing the remote twice. try this method:

  1. in studio click on the following keys: shift + control + F
    → this will open a tab where you can search for certain things in all of the scripts in your game
  2. search for remote:FireClient. if there are more than 2 scripts than make sure there’s only 1.
1 Like

its in startercharacterscripts

there was only 1 and ty i didnt know this existed but i found out what happened.

So what happened was that I think i may have tampered with a normal script and changed its runcontext to client as seen here:
image
The problem with this is that normally with a startercharacter scripts, it would go into the player character and the one specifically in startercharacter would be disabled but instead the one in the players character and the one in starterplayer.startercharacter would fire. I just put in a normal local script with the same code and it works noramlly now, thank yall boys!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.