I have a question. so am trying to basically make a text number go higher. so I have a text named Day: 0 and so am trying to make it so after the day is over its adds 1. so that’s mean it will say Day: 1. is it possible to do that?
script:
local Day = game.Players.LocalPlayer.PlayerGui.DayGui.Day
while wait() do
wait(5)
game.ReplicatedStorage.Spider:Clone().Parent = game.Workspace
game.Lighting.ClockTime = 19
wait(5)
game.Workspace.Spider:Destroy()
wait(0)
Day.Text = “Day:”
end
1 Like
Yes you can do it.
You may create a value when a day ends script will add 1 to value. And a script will put text in TextLabel
Example:
While true do
if game.Lighting.ClockTime == 19 then
script.parent.ValueName.Value=script.parent.ValueName.Value +1 -- Put own position of value.
game.Lighting.ClockTime = 19.01 --anti-bugger (Example: if value still same then it will still add 1)
end
wait(0.01)--or change it to what you needs.
end
Then script to textlabel
while true do
script.Parent.TextLabelName.Text =("Day:"..script.parent.ValueName.Value)--put your own position of value and TextLabel in your game.
wait(0.1)--or what you want.
end
how do I create the value. can you explain more if that’s fine to ask.
so should I put the value in workspace?
Put it where you need.
Yes you may put it in workspace.
can you explain where should I put the scripts. like do I delete the other and replace it with the script you gave me. since I keep getting errors and am kinda confused on what you mean.
can you explain from the start?
Okay.
If you dont want to read just download this file: Example.rbxl (32.4 КБ)
First
we need to put value into workspace:
Go to explorer (in studio) then direct mouse on workspace when you see a + click on it.
Studio will open a menu where we can add an object.
We see text Search object.
Clicking on it.
Putting: Value
then choosing NumValue (for example)
value is created now we can name it what we want.
Second
we need to create a script what will add 1 to value when Lighting.ClockTime gets to 19.
Again directing mouse to Explorer to Workspace text and to +
Typing in search : script
choosing basic script type
then will open script menu
Third: creating the script
while true do
if game.Lighting.ClockTime==19 then
script.parent.Value.Value=script.parent.Value.Value+1 -- this line will add 1 to our value
wait(0.01)--you can remove this wait if its not needed for you
game.Lighting.ClockTime=19.01-- This line will debug our "if"
end
wait(0.01)
end
Fourth: Creating TextLabel
going to StarterGui and pressing + (how we did it with value and script.)
Putting: ScreenGui and pressing on it
Then creating Textlabel
Fifth: Last step
creating script:
while true do
script.parent.TextLabel.Text = ("Day:"..workspace.Value.Value)
wait(0.05)
end
Done(me may errored at a moment cuz im lazy)
so I just finished ( I think since am not getting any errors ) so may you explain what these scripts are supposed to do? like a day and night script or?
what script you saying about?
this?
while true do
if game.Lighting.ClockTime==19 then
script.parent.Value.Value=script.parent.Value.Value+1 -- this line will add 1 to our value
wait(0.01)--you can remove this wait if its not needed for you
game.Lighting.ClockTime=19.01-- This line will debug our "if"
end
wait(0.01)
end
yes that one. am just asking what the scripts are supposed to do
this script will detect when ClockTime gets to 19
if ClockTime at 19 then script will add 1 to value (just count about day is passed and night or next day started).
so i need to make a script that makes it reach to clocktime 19 right?
wait i see how it works now! also i have another question. it there a way to make a script go to day and night like. the clock time starts at 12 and then starts counting up after a wait time like 12.1 then it goes to 12.2 until its reachs 19 clocktime?
sorry forgot to reply to you but the message is above this message.
but im already created the script.
for its detected clocktime 19 and add 1 to days value.
i mean i can see the value going up when i change the clocktime to 19 but it doesnt change.
you about ClockTime?
its isn’t changing?