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

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

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

✓ Accepted answer

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

19 comments

0

ok thanks

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?

0

do you by chance have another loop above the while loop line like repeat wait or while true do

0

nope thats all the code I have

0

it seems to be working for me

0

the full script is included in the edit

0

yep

0

are you sure the script is a local script and is not disabled?

0

What does disabled mean?

0

the property called enable making it false makes the script not run at all

0

How do I check if its disabled?

0

look at the properties Tab

0

Yea its definitely enabled

0

Wait I think I found the issue

0

Nope it didn't even run the script still

0

try to test this script inside of a empty baseplate if it works then its definitely some of your script thats not woking

0

ok I will try it

0

tysm I found the issue! I didn't put the text at the end of it! Silly me! Thanks for helping me!

0

np

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