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

I made a time GUI But it doesn't show up when i test the game. Any answers?


TimeValue = Instance.new("NumberValue")
local TextLabel = game.StarterGui.ScreenGui.TextLabel

while true do
         TimeValue.Value = 6
         TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]"
         wait(30)
         TimeValue.Value = 7
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "AM" .. "[Day Shift]"
        wait(30)
         TimeValue.Value = 8
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "AM" .. "[Day Shift]"
        wait(30)
         TimeValue.Value = 9
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "AM" .. "[Day Shift]"
        wait(30)
         TimeValue.Value = 10
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "AM" .. "[Day Shift]"
        wait(30)
          TimeValue.Value = 11
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "AM" .. "[Day Shift]"
        wait(30)
         TimeValue.Value = 12
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "PM" .. "[Day Shift]"
        wait(30)
         TimeValue.Value = 1
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "PM" .. "[Day Shift]"
        wait(30)
         TimeValue.Value = 2
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. "PM" .. "[Day Shift]"
end

8 comments

0

Hello trickortreat, sorry to say but your script's font is all messed up! It also needs more information and description. I have sent into Moderation so hopefully an Administrator can help you re-arrange your font and help you describe your problem slightly better. Anyhow, enjoy scripting!

0

TheOnlySmarts here is the script

0

hey onlysmarts

0

Hey! What's up?

0

Please fix your code block

0

Don't use game.startergui ... when making a ui on the client you need to add it to the PlayerGui instead.

0

fixed the code block

0

hey hey! I do an answer ;)

2 answers

When you define TextLabel, you need to use the instance in the PlayerGui(on the client.) So through a local script (if placed inside the textlabel) just do

local textLabel = script.Parent

Please be more descriptive with your questions in the future. Though I can see what your problem is based on the title, it is hard for us to get you the help you need to actually fix the problem if we don't know things like...what kind of script it is, where the script is, what you are trying to achieve, etc etc.

You can try to make an IntValue, I always use IntValue to make the game works. Maybe it will like this. You don't need to type so much. I might just help you make the script become not messy so you can maybe find out the answer.

local TimeValue = Instance.new("IntValue") -- maybe try IntValue instead of NumberValue
local AM_Or_PM = Instance.new("Part") -- make it find out was the timer is AM or PM
local IntValue = Instance.new("IntValue") -- Set this make the AM_Or_PM sets AM_Or_PM
TimeValue.Value = 6 -- set the start value
--the part properties--
AM_Or_PM.Name = "AM"
AM_Or_PM.Transparency = 1
AM_Or_PM.Position = Vector3.new(0,0,0)
AM_Or_PM.Anchored = false
AM_Or_PM.CanCollide = false
AM_Or_PM.Parent = game.Workspace
IntValue.Value = 0
--Don't delete those

while true do

	wait(30)
	if TimeValue.Value > 12 then
		if IntValue == 0 then
			AM_Or_PM.Name = "PM"
			IntValue.Value = 1
			TimeValue.Value = 1
			else
			AM_Or_PM.Name = "AM"
			IntValue.Value = 0
			TimeValue.Value = 1
		end
		else
	TextLabel.Text = "Time:" ..TimeValue.Value..":00".. AM_Or_PM.Name .. "[Day Shift]"
	TimeValue.Value = TimeValue.Value + 1
	end
end

Maybe this will help you! My Roblox Studio crashed while I run this script, if you see that doesn't have any errors, please accept my answer :D If it not work, then I hope ya... Happy coding ;D

1 comment

0

It crashed becuase you forgot the wait() on the infinite loop lol.

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