Here is the local script
local Gui = script.Parent
local player = game.Players.LocalPlayer
Gui.BackgroundColor3 = Color3.new (0, 151/255, 111/255)
function sw()
if Gui.BackgroundColor3 == Color3.new (0, 151/255, 111/255) then
Gui.BackgroundColor3 = Color3.new(208/255, 174/255, 0)
print ("Works")
wait(3)
Gui.BackgroundColor3= Color3.new(1, 6/255, 26/255)
local k = game.ReplicatedStorage.IDCard:Clone()
k.Parent = player.Backpack
game.Workspace.MyServerEvent:FireServer()
else
wait (2)
game.Workspace.MyServerEvent:FireServer()
Gui.BackgroundColor3= Color3.new(1, 6/255, 26/255)
wait (1)
end
end
Gui.MouseButton1Down:connect(sw)
game.Players.PlayerRemoving:connect(function(player)
if player.Backpack.IDCard == "k" then
Gui.BackgroundColor3 = Color3.new(0, 152/255, 111/255)
end
end)
Here is the other script
local event = Instance.new("RemoteEvent")
event.Parent = game.Workspace
event.Name = "MyServerEvent"
event.OnServerEvent:connect(function()
game.StarterGui.ScreenGui.Frame.TextButtonss.BackgroundColor3 = Color3.new(1, 6/255, 26/255)
print ("Color has been changed in the server")
end)
What I'm trying to do ,is, when a player clicks on the textbutton they receive a key and the textbutton gui turns red for the WHOLE SERVER, so everyone knows that the room is booked out.
