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

why will this script only focus on the first value?

Asked by
zValerian 108
5 years ago
Edited 5 years ago

when I run this script:

SERVER SCRIPT

wait()
text = script.Parent.text
if script.Parent.PlayerCount.NumOfPlayers.Value == 1
    then 
    text.Value = "Welcome to SURVIVAL GAMES!"
    game.ReplicatedStorage.Remotes.ann:FireServer()
    wait(10)
    text.Value = "If you don't know how to play, read the description!"
    game.ReplicatedStorage.Remotes.ann:FireServer()
    wait(10)
end

it is supposed to run this one

LOCAL SCRIPT

wait()
local text = game:GetService("ServerScriptService").text.Value
game.ReplicatedStorage.Remotes.ann.OnServerEvent:Connect(function(qnay)
    script.Parent.Visible = true
    script.Parent.TextButton.Text = text
end)

however, it gets stuck on 'WELCOME TO SURVIVAL GAMES' and doesnt go on to the next value any ideas why

1 answer

Log in to vote
0
Answered by 5 years ago

I believe this is a situation where you aren't updating the client and server.

I'm assuming that since you are using the :FireServer() Method that the top script is a local script. Now before I clarify the issue, have you -

  1. Make sure the script firing the method is in a local script
  2. Parented to a game object that will work with a Local script

Also I'm assuming that the bottom part of the script is a server script.

If so the issue is that while you updated the value, "text.Value", on the client. You did not update it on the server, which does not know that that value has been updated.

If you want to make the text change, you should change the text on the server side, the bottom script.

0
hey its the other way around, the top is the local and the bottom is the server script zValerian 108 — 5y
0
You can only :FireServer() in a local script if that is the case. guestnot99 112 — 5y
Ad

Answer this question