Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

My RemoteEvent only prints what I want in Solo mode, How do I fix this?

Asked by 7 years ago
Edited 7 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

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.

1 answer

Log in to vote
0
Answered by 7 years ago

try adding a wait(2) at line 1

Ad

Answer this question