I’m trying to make cuffs that if the target is on a certain team or has a wanted level of 1 or above while being on a different team the target should be set into a certain team before being reset. It also should set the wanted level back to 0. I have checked for simmilar posts and such but got no results. A system that gets a target would be enough. I would be able to figure out the rest.
What exactly do you mean by reset and then to a different Team, like you cuff that Person, the Person gets to a new Team and wanted level goes to 0 and then resets?
the target gets set to a certain team and gets their wanted level set to 0 and then gets :LoadCharacter() ed
So when you have the cuffs out and you press on someone, and then this happens right?
that is the plan. correct. But before it takes action it checks if the wanted level is 1 or above.
So you want a script, just to cuff a target (to get the target)?
correct. the rest i can figure out myself.
Wouldn’t that be abuse, to get everyone even when the wanted Level is 0? Anyway, I will try my best.
that’s why i want it so only when wanted level 1 or above get
So uh, I only got the target. Or do you also meant, to grab the player infront of you. (Took so long, because a friend wanted something from me)
i just need a script that gets the player that got clicked on nothing more. the rest i want to do myself to challenge myself
This is the localscript in to 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 player = game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent)
if player then
local WantedValue = game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent).YOURPATH
if WantedValue.Value >= 1 then
script.Parent.RemoteEvent:FireServer("Cuff", game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent))
else
end
else
end
else
end
end
end
end)
Add a remote into the Tool and ServerScript
script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player, RESULT, TARGET)
if RESULT == "Cuff" then
local WantedValue = TARGET.YOURPATH - Path to Wanted (Remote Security)
if WantedValue.Value >= 1 then
else
end
end
end)
And this should be finished, if there is an error let me know or try to fix it.
the server script goes where and how will the remote in the tool and the one in the server script connect?
NVM Got it. ig i just never really understood remote events
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 player = game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent)
if player then
local WantedValue = game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent).leaderstats.WantedLevel
if WantedValue.Value >= 1 and player.Team.Name == "Inmate" or player.Team.Name == "Fugitive" then
script.Parent.RemoteEvent:FireServer("Cuff", game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent))
else
print("not eligable for arrest")
end
else
end
else
end
end
end
end)
script.RemoteEvent.OnServerEvent:Connect(function(Player, RESULT, TARGET)
if RESULT == "Cuff" then
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
character:FindFirstChild("Humanoid").CharacterWalkSpeed = 0
wait(3)
TARGET.Team.Name = "Inmate"
TARGET:LoadCharacter()
else
end
end
end)
here is the current version already prepared for what i need it
Is it fixed or should I take a look?
please have a look. i can’t figure that out.
Oh sorry, on line then you should do player instead of
game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent)
So like:
player.leaderstats.WantedLevel
let me guess. instead of
script.Parent.RemoteEvent:FireServer("Cuff", game.Players:GetPlayerFromCharacter(player:GetMouse().Target.Parent))
just
script.Parent.RemoteEvent:FireServer("Cuff", game.Players:GetPlayerFromCharacter(player))
?