local Groupservice = game:GetService("GroupService")
local GroupId = 4963920
script.Parent.Touched:Connect(function(Hit)
local H = Hit.Parent:FindFirstChild("Humanoid")
if H then
local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if player:IsInGroup(GroupId) then
print("this player is in the group")
else
print("this player is not in the group")
end
end
end)
Using this in a Script , as opposed to a LocalScript , will not get you the most up-to-date information. If a player leaves a group while they are in the game, IsInGroup will still think they’re in that group until they leave. However, this does not happen when used with a LocalScript.
You might want to use remotes here, to do the check on the client.
Then that would explain why this doesn’t work since localscripts doesn’t work when they are a descendant of a workspace and not parented by a character model. Consider using a serverscript instead.