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

Why does my TextLabel's Text keep resetting when ResetOnSpawn is off?

Asked by 4 years ago

Hello, I am having an issue and I would love it if somebody could help me.

So I have a TextLabel with Text inside of it. I also have ResetOnSpawn check to false - however when I respawn, it still continues to reset - and goes back to 'placeholder'. This is where I have my GUI placed.

https://imgur.com/a/BEygPAr

If you are curious to what is inside of 'PlayerAddedClient' then here it is.

local r1 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r1
local r2 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r2
local r3 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r3
local r4 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r4
local r5 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r5
local label = script.Parent.GUIS.Objectives:WaitForChild("Label")

r1.OnClientEvent:Connect(function(remote1)
    label.Text = "Get to 150 Evolutions to Upgrade!"
end)

r2.OnClientEvent:Connect(function(remote1)
    label.Text = "Get to 500 Evolutions to Upgrade!"
end)

r3.OnClientEvent:Connect(function(remote1)
    label.Text = "Get to 1500 Evolutions to Upgrade!"
end)

r4.OnClientEvent:Connect(function(remote1)
    label.Text = "Get to 3750 Evolutions to Upgrade!"
end)

r5.OnClientEvent:Connect(function(remote1)
    label.Text = "Get to 6050 Evolutions to Upgrade!"
end)

Now you might want to check out the other script that Fires these Events. Well, here it is.

local r1 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r1
local r2 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r2
local r3 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r3
local r4 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r4
local r5 = game.ReplicatedStorage:WaitForChild("Events").PlayerAdded.r5

game.Players.PlayerAdded:Connect(function(plr)
    if plr:WaitForChild("Objective").Value == 0 then
        r1:FireClient(plr, "remote1")
        print('remote1')
    elseif plr:WaitForChild("Objective").Value == 1 then
        r2:FireClient(plr, "remote2")
        print('remote2')
    elseif plr:WaitForChild("Objective").Value == 2 then
        r3:FireClient(plr, "remote3")
        print('remote3')
    elseif plr:WaitForChild("Objective").Value == 3 then
        r4:FireClient(plr, "remote4")
        print('remote4')
    elseif plr:WaitForChild("Objective").Value == 4 then
        r5:FireClient(plr, "remote5")
        print('remote5')
    end
end)

The script above is placed/located in ServerScriptService in a folder called, 'Server'.

So yeah I am very confused about this - and I can't duplicate this into ReplicatedStorage and clone it into PlayerGui because it needs a lot of experience and information - and I'd rather not waste my time doing that when ResetOnSpawn should be correctly working and shouldn't Reset when I respawn.

Thanks, TheOnlySmarts.

0
Try add "plr.CharacterAdded:Connect(function()" in your second script OnaKat 444 — 4y
0
Doesn't work because this would only be able to placed inside the PlayerAdded function(however when the player dies, the player isn't being Added, the Character is) and this would probably work. However this is a server script so I cant define plr if I can't access the client. TheOnlySmarts 233 — 4y
0
However I tried accessing the plr variable by doing, 'for i, plr in pairs' but it still showed no effect - this issue is starting to tick me off... TheOnlySmarts 233 — 4y

Answer this question