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

LocalPlayer cannot change a value inside the player?

Asked by 6 years ago
button = script.Parent
player = game.Players.LocalPlayer

button.MouseButton1Click:connect(function()
    if button.Text == "Not ready" then
        button.Text = "Ready"
        player.ready.Value = true
    elseif button.Text == "Ready" then
        button.Text = "Not ready"
        player.ready.Value = false
    end
end)

  • Localscript inside a button in startergui
  • Works fine in studio play, not in local/real servers
  • It changes the text, but not the value

rip

0
Is FE enabled? GetGlobals 343 — 6y
0
yup User#20388 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

The issue is that you have filtering enabled turned on. A simple solution to fixing this issue is by doing this

Inside the localscript at ur button

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)

then have a remote event called ready inside of ur replicatedstorage. Then use a script inside of ServerScriptService with this code

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

If this helped then tag this as answered. If you get any errors comment on this and ill try to help :D

0
Thx dude :D User#20388 0 — 6y
Ad

Answer this question