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

Why wont my script update a textlabel for all players?

Asked by 7 years ago
Edited 7 years ago

I made a script that teleports all players to a map and starts a time limit(changes the value of an intvalue and a textlabel has a script inside of it that changes the text to the intvalue value and has a wait time of .1 every time.) Everything works, except for the actual textlabel for the players. Ive tried getting help from other places and seeing if there was any alternatives for some stuff in the script but nothing has worked. Please Help me.

local timeleft = game.ServerStorage.TimeLeft
local slot = game.ServerStorage.Slot

while true do
slot.Value = "Intermission..."
timeleft.Value = 25
for i=1,25 do
timeleft.Value = (timeleft.Value - 1)
wait(1)
end
 for i, v in pairs(game.Players:GetPlayers()) do
        v.Character.Torso.CFrame = CFrame.new(Vector3.new(-46.518, 1.834, 1.948))
    end
slot.Value = "In Game:"
timeleft.Value = 320

for i=1,320 do
    timeleft.Value = (timeleft.Value - 1)
    wait(1)
end

for i, v in pairs(game.Players:GetPlayers()) do
        v.Character.Torso.CFrame = CFrame.new(Vector3.new(-4434, 57.041, 46))
    end

end



slot is basically "intermission..." or "ingame" time left is how much time is left.

textlabel script(for the time)

while true do
    wait(.1)
    script.Parent.Text = game.ServerStorage.TimeLeft.Value
end

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You're trying to make it so a client can access something on the server. Clients can't see anything in game.ServerStorage.

Try moving slot to game.ReplicatedStorage.

Also, consider changing your client code to the following:

game.ReplicatedStorage.Slot.Changed:connect(function(Change)
 x = TEXTLABEL LOCATION
x.Text = game.ReplicatedStorage.Slot.Value
end)
0
You shouldn't even be using values for this sort of thing, he should be using RemoteEvents/RemoteFunctions, but whatever. e_e joritochip 705 — 7y
Ad

Answer this question