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

The GUI isn't changing when it should. Is this complicated or not?

Asked by 2 years ago

I am changing a GUI TextLabel and it is not changing for some reason. In other words, I need help.

game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 1


while true do   
    local speed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed
    print(speed)
    if speed > 0 then
        game:GetService("StarterGui").ScreenGui.TextLabel.Text = "NOT FROZEN"
        local Random = math.random(1,200)
        if Random < 199 then
            speed = speed + math.random(1,3)
            wait(1)
        else
            speed = 0
            wait(1)
        end
    else
        game:GetService("StarterGui").ScreenGui.TextLabel.Text = "FROZEN"
        wait(30)
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 1
    end
end

I now I cannot use the variable speed in some parts but If I do not the whole thing shows horribly. I hope you can help!

1 answer

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
2 years ago
Edited 2 years ago

Use game.Players.LocalPlayer.PlayerGui starter gui is the gui for every player that joins

game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 1
while true do   
    local speed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed
    print(speed)
    if speed > 0 then
        game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = "NOT FROZEN"
        local Random = math.random(1,200)
        if Random < 199 then
            speed = speed + math.random(1,3)
            wait(1)
        else
            speed = 0
            wait(1)
        end
    else
        game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = "FROZEN"
        wait(30)
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 1
    end
end
0
ok thanks Puppy_lovertheawsome 84 — 2y
0
So I just swapped them out and the didn't even do anything! It didn't even print the speed at the start! There was also no error. Any Ideas to why this happened? Puppy_lovertheawsome 84 — 2y
0
do you by chance have another loop above the while loop line like repeat wait or while true do Puppynniko 1059 — 2y
0
nope thats all the code I have Puppy_lovertheawsome 84 — 2y
View all comments (15 more)
0
it seems to be working for me Puppynniko 1059 — 2y
0
the full script is included in the edit Puppynniko 1059 — 2y
0
yep Puppy_lovertheawsome 84 — 2y
0
are you sure the script is a local script and is not disabled? Puppynniko 1059 — 2y
0
What does disabled mean? Puppy_lovertheawsome 84 — 2y
0
the property called enable making it false makes the script not run at all Puppynniko 1059 — 2y
0
How do I check if its disabled? Puppy_lovertheawsome 84 — 2y
0
look at the properties Tab Puppynniko 1059 — 2y
0
Yea its definitely enabled Puppy_lovertheawsome 84 — 2y
0
Wait I think I found the issue Puppy_lovertheawsome 84 — 2y
0
Nope it didn't even run the script still Puppy_lovertheawsome 84 — 2y
0
try to test this script inside of a empty baseplate if it works then its definitely some of your script thats not woking Puppynniko 1059 — 2y
0
ok I will try it Puppy_lovertheawsome 84 — 2y
0
tysm I found the issue! I didn't put the text at the end of it! Silly me! Thanks for helping me! Puppy_lovertheawsome 84 — 2y
0
np Puppynniko 1059 — 2y
Ad

Answer this question