Handcuffs that resets target and sets target into team after 3 seconds when wanted value is 1 or above or they are on a specific team

now the Local stuff works but now we have a problem with the server side
image

Try printing in the RemoteEvent print(TARGET.Name) and look if the name pops up.

Also I made a mistake, in the local script. You need to replace a player with player2, because there are two locals with the same one.

image


image

you are only sending 2 values but want to recieve 3.

the problem was that you didn’t send a value with the name “TARGET” so it didn’t recieve one

Local Script inside of the tool

local Tool = script.Parent
local player = game.Players.LocalPlayer

Tool.Activated:Connect(function()
	if player then
		if player:GetMouse() then
			if player:GetMouse().Target.Parent:FindFirstChild("Humanoid") then
				local player2 = game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent)
				if player2 then
					local WantedValue = player2.leaderstats.WantedLevel
					if WantedValue.Value >= 1 and player2.Team.Name == "Inmate" or player2.Team.Name == "Fugitive" then
						local TARGET = player2
						workspace.Arrest.RemoteEvent:FireServer("Cuff", TARGET)
					else
					print("not eligable for arrest")
					end
				else
				end
			else
			end
		end
	end
end)

Server Script in Workspace with the Remote event in it

script.RemoteEvent.OnServerEvent:Connect(function(Player, RESULT, TARGET)
	if RESULT == "Cuff" then
		print(TARGET.Name)
		local WantedValue = TARGET.leaderstats.WantedLevel -- Path to Wanted (Remote Security)
		if WantedValue.Value >= 1 and TARGET.Team.Name == "Inmate" or TARGET.Team.Name == "Fugitive" then
			local character = TARGET.Character
		 local h =	character:FindFirstChild("Humanoid")
			if not h then
				return
			end
			h.WalkSpeed = 0
			wait(3)
			TARGET.Team = game.Teams.Inmate
			wait()
			TARGET:LoadCharacter()
			h.WalkSpeed = 18
		else
		
		end
	end
end)

thanks to @nayro007 for the script and debugging help!

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