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(15922097) then
script.Parent.CanCollide = false
script.Parent.BrickColor = BrickColor.White()
wait(1)
script.Parent.CanCollide = true
script.Parent.BrickColor = BrickColor.new(151,0,0)
else
script.Parent.CanCollide = true
end
end
end)
How can I achieve this? Would this work?
if game.Players[hit.Parent.Name]:IsInGroup(4324824) or game.Players[hit.Parent.Name]:IsInGroup(34288432)
You are on the right track, but need to tweak your script a little bit. script.Parent.Touched:connect(function(hit)
if (hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)) then
local player = game.Players[hit.Parent.Name]
if player:IsInGroup(15922097) or player:IsInGroup(34288432) then
script.Parent.CanCollide = false
script.Parent.BrickColor = BrickColor.White()
wait(1)
script.Parent.CanCollide = true
script.Parent.BrickColor = BrickColor.new(151,0,0)
else
script.Parent.CanCollide = true
end
end
end)
The script should be checking if the player is in either group before letting them through.