✓ Accepted answer
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 =
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local character = hit.Parent
if character:FindFirstChild("Keycard") then
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")
local remote =
remote.OnClientEvent:Connect(function()
imageLabel.Image = ""
end)
And that should do it
2 comments
use a remote event
I know that I need to use a remote event, however I'm not really good at scripting. Can you do me a favor?