I want to make a script where if a player gets detained, they get teleported to a certain X,Y using HumanoidRootPart when the person detaining the player presses a “Jail” TextButton. I have a slight idea of how to do it but not sure how to do it to only a specific person that’s in cuffs.
I would have to make a script in the jail text button which would teleport the player cuffed to a certain X,Y. Example: game.Players.PlayerCuffed.Character.HumanoidRootPart.CFrame = CFrame.new(0, 0, 0)
The thing I don’t know how to do, is for it only to affect the player that is detained not all the players. Basically I just need to create a variable that defines the cuffed player. Example: local PlayerCuffed = ………. So then I can make it only affect the cuffed player. I know this is kinda hard to understand but yeah I just need something to define the cuffed player apart from the rest of the players. Thank you for your time!

2 comments
So after seeing the script you provided, I think I didn’t provide sufficient information. So I want to make like a script that goes inside of a tool that when you click your mouse on a person in-game, they get teleported infront of you and they can’t move but you can move them. Then, if you press a text button that is on screen the player that is infront of you gets sent to the location.
I know how to make everything else work I just need a variable to define the player that is infront of me (which I clicked on and IsCuffed) For example: local CuffedPlayer = game.Players.CuffedPlayer and local JailButton = script.Parent