Greetings,
Perhaps the question is a tad basic, but I am literally struggling. I have tried all possible sources of information, but nothing helped. My sole question is how do I manage to make it so when a player touches a part (let's name it pad), their tools are removed and if they reset they will be respawned on that pad.
Basically, like a jail - if they die, their character gets loaded on the pad (inside the cell), not at the Spawn. Also, regarding Data Store, how do I make the above (the whole jail script) work (remember that player X was in jail when they left and if they return, they are put back in jail) each time a player re-enters the game?
(The whole jail script should work and act as it does when the player is on the pad, if the player is not on the pad and leave, they just spawn at the Spawn point when re-entering and the whole jail script does nothing to them).
I would really appreciate help as I am very stuck here.
The very basic code of which I am ashamed (I managed the remove tools part... but I have no idea with the rest):
pad = script.Parent -- The Pad, which is going to be touched
function hit(pad) -- If the pad is touched, then the tools are removed
if hit == nil then return end
local h = game.Players:GetPlayerFromCharacter(pad.Parent)
if h ~= nil then
local c = h.Backpack:GetChildren()
for i=1,#c do
c[i]:remove()
end
end
end
script.Parent.Touched:connect(hit)
Thank you, Have a wonderful day!

1 comment
Thank you very much I really appreciate. I would kiss you... but that would be awkard, heh.