Cuff handler Problems

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I’m currently trying to figure out how to make this script work onto every player in the game.

  2. What is the issue?
    The gui and script will only work on players that joined before the player that joined unless that player resets.

  3. What solutions have you tried so far?
    While wait() do
    wait true do
    wait()

game:GetService("RunService").RenderStepped:Connect(function()
	for i ,v in pairs(game.Players:GetPlayers()) do
		if v.Name ~= LocalPlayer.Name then
			if v.Character and v.Character.HumanoidRootPart then
				if (LocalPlayer.Character.HumanoidRootPart.Position - v.Character.HumanoidRootPart.Position).Magnitude <= 6 then
					local NearestPlayer = v.Name
					script.Parent.NearestPlayer.Value = NearestPlayer
					clone.Adornee = v.Character.Torso
					clone.Enabled = true
					if v.Character.Humanoid.Sit == true then
						cg = false
						grb.Visible = false
						clone.List.Key.TextLabel.Text = "Eject - "
						clone.List.Key.ImageLabel.TextLabel.Text = "X"
						cc = nil
						rv = true
					else
						if Cuffed == true then
							grb.Visible = true
							cg = true
						end
						clone.List.Key.ImageLabel.TextLabel.Text = "C"
						cc = false
						rv = false
						if Cuffed == true then
							clone.List.Key.TextLabel.Text = "Relase - "
						else
							clone.List.Key.TextLabel.Text = "Handcuff - "
						end
					end
					if show == true then
						cf.Visible = true
					else
						cf.Visible = false
					end
				end
			end
1 Like

it looks like it is some sort of issue with players you said it wont work right its because render stepped runs a 2 second time

Would there be any way to resolve this problem and not having to write the whole code over again?

try making it server sided if not then make another method to fix it
render stepped wont work on the server so use Heartbeat instead

.RenderStepped event fires every frame, before the frame is rendered

Thanks i’ll do some research and find a solution to it.

No, don’t make it server side, half of it.
Use collection service to tag all humanoid root parts (serverside)
and from Client, iterate trough the table passed when using CollectionService:GetTagged()
And do the adornee or whatever you do.
And when cuffing check if what client sees its equal what server sees to prevent exploiting

The script changes the nearest value to the right player but won’t change the adornee and the rest of the script?