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

Why doesn't this Value work?

This is my code. Problem: Stays on 0 C all of the time. What I want: I want it to work and to display the currentTemp rightly without it being stuck on 0 C.

And yes, I have checked if the value is going up and down. Yes it is. Also, no error output

Thanks, Nathan.

My script layout:

Workspace	
		Please wait -- Module
				Humanoid	-- Humanoid
						TempNameChange -- This script
								Head -- Displays temp

Script:

currentTemp=game.Workspace.TemperatureValue.Value

while true do
	wait()
	script.Parent.Name = ""..currentTemp.." C"
end

1 answer

✓ Accepted answer

If you want to make words above the brick, change the name of the model, not the humanoid.

To decrease lag, why not wait for 0.5 seconds? It's still pretty fast, but a lot slower than a 30th of a second.

Finally, when you define your variable on line 1, that variable will equal whatever the value of TemperatureValue is at the time the variable is create. It will not change when the value changes.

currentTemp=game.Workspace:WaitForChild("TemperatureValue") --Just in case the value is not loaded when the script runs. 

while true do
	wait(0.5)
	script.Parent.Parent.Name = currentTemp.Value.." C" --No need for the extra ""
end

3 comments

0

THANK YOU SO MUCH! ;D

0

Why not use the Changed event?

0

You could also do that but I was helping him debug the script he created.

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