Basically, I have made a respawn on touch script. Just wondering how I'd add group ranking into it. So I can keep trolls, exploiters, etc out of the STAFF only area. e.e What I've done so far:
script.Parent.Touched:connect(function(Hit) -- Activates if Touched Player = Game.Players:GetPlayerFromCharacter(Hit.Parent) -- Checks if what touched has a player. if Player then -- Checks the Player Player:LoadCharacter() -- Loads if it is a Player end -- Ends the "if" statement. end) -- Ends the function.
RBXScriptSignal:connect()
is deprecated, prefer RBXScriptSignal:Connect()
instead. I also recommend indenting once per scope.
local GroupId = 30 local StaffRolesetId = 5 script.Parent.Touched:Connect(function(TouchingPart) if not TouchingPart.Parent then return end local Player = game.Players:GetPlayerFromCharacter(TouchingPart.Parent) if not Player then return end if Player:GetRankInGroup(GroupId) >= StaffRolesetId then return end Player:LoadCharacter() end)