Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Rank only kill script?

I am not good with scripting but this is what I tried to make.



local rank = 25,255 -- The rank the player will need to get through (out of 255)
local groupID = 1139999 -- The group ID the player must be in

script.Parent.Touched:connect(function(hit)
	if (hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)) then
		if (game.Players[hit.Parent.Name]:IsInGroup(groupID) and game.Players[hit.Parent.Name]:GetRankInGroup(groupID) == rank) then
	else human.Health= 0 
		end
	end
end)

What I wanted the script to do was Kill someone if they weren't in the right rank.

1 answer

✓ Accepted answer
local rank = 25 -- The rank the player will need to get through (out of 255)
local groupID = 1139999 -- The group ID the player must be in

script.Parent.Touched:connect(function(hit)
	if (hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)) then
		if (game.Players[hit.Parent.Name]:IsInGroup(groupID) and game.Players[hit.Parent.Name]:GetRankInGroup(groupID) >= rank) then
			--Do nothing
		else
			hit.Parent:BreakJoints()
		end
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.