So I have been recently trying to make a click detector that make a part become semi transparent only for a group. I am able to do this for everyone but not for just a group. I tried this:
local player = game.Players.LocalPlayer local groupId = 3793549 function test() if player:IsInGroup(groupId) then game.Workspace.Part.CanCollide = false game.Workspace.Part.Transparency = 0.5 wait(3) game.Workspace.Part.CanCollide = true game.Workspace.Part.Transparency = 0 end end game.Workspace.Part.ClickDetector.MouseClick:Connect(test)
I put the script in game.StarterPlayer.StarterPlayerScripts . Any advice? Also the script needs to affect everyone. It just needs to activate only from group members.
That current script is a LocalScript
. Any code in that local script will only execute on and for the player running the script. My advice would be to have a RemoteEvent
listen for the OnClientEvent
event. The event will set the transparency to 0.5 and do the other things. Then you'd check if the player who clicked the part is in the group, and if they are, loop through the players on the server, check if they're in a group, and calling FireClient
on said players. That would fire OnClientEvent
, showing the part changes to the group members.