The script I have isn't working and I'm unsure of how to change it. The script needs to be killing someone ontouch if not a rank in the group. Does anybody know if they have a script like that?
COMMUNITY QUESTION
Kills player on touch script if not a rank?
1 answer
script.Parent.Touched:connect(function(hit) --calling touched function when brick is touched
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum ~= nil then -- checking to make sure that whatever hit the brick is a player
local rank = game.Players[hit.Name]:GetRankInGroup(groupid) --getting players rank in group
if rank == "" then -- replace with whatever rank in group (1-255)
print("blablabla")
end
end
end)
code will look something like that (haven't actually tested this myself in game so apologies if it doesn't work.)
please note that rank and role are separate things, the rank is the ID of the rank, so owner would be 255, and role (GetRoleInGroup(groupid)) returns the actual name of the rank.
1 comment
0
The script doesn't actually kill the player ontouch,
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Try this: http://wiki.roblox.com/index.php?title=API:Class/Player/GetRankInGroup