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

How can I make my GUI Button communicate READY to the server side?

Asked by
JipSea 23
4 years ago
Edited 4 years ago

Hello! I have a GUI where a player can click "READY" or "NOT READY" and if they click READY it will fire an event called Ready in Replicated Storage.

I am receiving the error "Ready is not a valid member of Player" error on my CLIENT side, When I need it to communicate to the SERVER (With no errors of course). Please help!

Local Script inside TextButton: (StarterGui)

button = script.Parent
player = game.Players.LocalPlayer
button.MouseButton1Click:connect(function()
    if button.Text == "Not ready" then
        button.Text = "Ready"
        game.ReplicatedStorage.Ready:FireServer()
    elseif button.Text == "Ready" then
        button.Text = "Not ready"
        player.Ready.Value = false
    end
end)

Script inside "ServerScriptStorage"

game.ReplicatedStorage.Ready.OnServerEvent:Connect(function(player)
game.Players[player.Name].Ready.Value = true 
end)

I have tried everything! PLEASE HELP I just need the server to know the player is "Ready" So it can continue. THANK YOU

1 answer

Log in to vote
0
Answered by 4 years ago

in your first script, you only fire the event when it is ready,


button.Text = "Ready" game.ReplicatedStorage.Ready:FireServer()

so in the second script, you really don't need this line,

game.Players[player.Name].Ready.Value = true


just do whatever you want it to do when it is ready. the error is correct. your player object really don't have a something called "Ready" in it. unless you create a boolean value first

0
This is the best answer I have received so far! I do not know a lot about boolean values though.. any suggestions there? THANKS! JipSea 23 — 4y
Ad

Answer this question