Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why is this String Value having its value wiped?

local replicatedstorage = game:GetService("ReplicatedStorage")
local status = replicatedstorage:WaitForChild("StatusValue")
math.randomseed(tick())

while true do
    for i = 10,0,-1 do
        status.Value = "Intermission:"..i
        wait(1)
    end
status.Value = "Loading New Map"
Number = math.random(1,1)
if Number == 1 then
	game.ReplicatedStorage.StatusValue2.Value = "Dystopian Plains"
 local Clone1 = game.ServerStorage.DYSTPLAINS:Clone()
Clone1.Parent = game.Workspace
end
for _,plr in pairs(game.Players:GetPlayers()) do
        plr.TeamColor = BrickColor.new("Really red")
        plr:LoadCharacter()
    end
    for i = 120,0,-1 do
        status.Value = "Game In Progress:"..i
        wait(1)
    end
   for _,plr in pairs(game.Players:GetPlayers()) do
        plr.TeamColor = BrickColor.new("White")
        plr:LoadCharacter()
    end
end

So this script keeps track of time, loads maps once the intermission is done, and teleports players with teams.

Now, I have two labels on the screen. One's text is based on StatusValue (A string Value) the other's text is based on StatusValue2( another string Value). The one based on Status value 2 is the one i am having problems with.

Before a server starts, the value of StatusValue2 is "Testing". when the script goes and Loads the map, it should change status value 2 to "Dystopian Plains". It does, for only a fraction of a second.When the code then changes the players team colr to "Really Red", the label on the screen displays "Testing", as if nothing happens.

If you have the time, please tel me what is wrong with this script.

BTW this script is in the serverscriptservice

1 answer

✓ Accepted answer

First, I recommend looking up proper indentation style - your indents are all over the place. It makes it a lot easier to follow the code and for everyone (including yourself) to detect errors.

Since your script only refers to the problem StringValue once, this script cannot be responsible for changing the StringValue back to "Testing". However, you also mention a TextLabel on screen displaying the value of this StringValue. So, either the script managing that TextLabel is not functioning correctly, or you have another script that is continuously setting the StringValue back to "Testing".

1 comment

0

Thanks! I saw a fault in the script managing the textlabel and just deleted the script. I'll just have this script manage the label directly.

This discussion is preserved as it was. New answers, comments, and votes are closed.