I want it so that if a person touch a part in workspace then all of the players GUI will be affected.
If a single player have a keycard ang he/she touch a door for example, then all of the player GUI will change image, but if that player touch while not holding or don't have a keycard on backpack then nothing will happen.
To do this you would need to use remote events as mentioned
First you have to check if a part is being touched while a keycard is equipped
Script in the part:
local part = script.Parent local remote = -- path to a remote event -- touched connection part.Touched:Connect(function(hit) -- check if what's hitting the part is a player if hit.Parent:FindFirstChild("Humanoid") then -- check if the player has a keycard -- equipped tools get parented to the character local character = hit.Parent -- the "Keycard" is the tool name we're searching for if character:FindFirstChild("Keycard") then -- if we're in here it means the player has the keycard equipped -- and touched the part. Now we have to use remotes to change -- everyone's UI remote:FireAllClients() end end end)
Now we've confirmed a player has touched and part with a keycard, and we've fired a remote to all the clients in the game. We now have to set up a script to listen for that remote being triggered and change the UI image accordingly.
Local script in the GUI:
local gui = script.Parent local imageLabel = gui:WaitForChild("ImageLabel") -- path to image local remote = -- path to the same remote as above remote.OnClientEvent:Connect(function() imageLabel.Image = "" -- change the image to a new image end)
And that should do it