How can I make this script work properly? This is a script that is inside a lava part in one of my obbys which is suppose to kill someone if they touch it, Anyways I tried making it so it would kill someone specific if they were in a specific group and rank with "GetRankInGroup" function but I could not get it to work.
This is the script:
local part = script.Parent
part.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local playername = hit.Parent.Name
if humanoid then
if playername:GetRankInGroup(2582242)== 255 then
humanoid.Health = 100
else
humanoid.Health = 0
end
end
end)
This is the functional script before I attempted adding "GetRankInGroup":
local part = script.Parent
part.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local playername = hit.Parent.Name
if humanoid then
if playername == "262187" or playername == "" then
humanoid.Health = 100
else
humanoid.Health = 0
end
end
end)

3 comments
I tested it, and it does not seem to work sadly, Nothing in the output either.
Well written answer.
Thanks. :)