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

How do I make This TextLabel Display the Current Event based on the ClockTime in game?

Asked by 2 years ago
Edited 2 years ago

In my game is a UI in the right top corner of the screen that displays the current time (7:00 AM, 10:30 AM) and below it is the current activity going on at school (Classtime, Lunchtime) I looked around to find some scripts that could help and I found this one script but I don't know certain terminology and details so I don't know exactly what to do with the script. I don't know whether it should be a LocalScript or not or any of that.

The UI is a ScreenGui and inside of it are Two Text Labels, one named CurrentTime, and the other named CurrentActivity. Inside of CurrentActivity is where this script is located which is why in the script I put "script.Parent.Text = Str" because I want the Text of the Parent (The CurrentActivity TextLabel) to display the text. But it also says to assign "Str" to something and I don't know what.

Anyways, here's the script, if anyone knows what to do, please let me know!

01local Schedule = {
02    ["6.50"] = "Before School",
03    ["7"] = "Before Class",
04    ["8.50"] = "Classtime",
05    ["13"] = "Lunchtime",
06    ["13.50"] = "Classtime",
07    ["15.50"] = "After School",
08    ["20"] = "Nighttime"
09}
10--Create a library which stores what you want to to be on the schedule
11--ClockTime uses 24/h time, so 10pm would be 22
12--Libraries act weird when you use numbers as the indexes, so I turn them to strings
13 
14local IntTime = Instance.new("IntValue", script)
15IntTime.Changed:Connect(function()
View all 27 lines...

Edit: Okay, so the script does work, sort of. The reason it wasn't changing was because I was play testing in Roblox Studio and for some reason it wasn't changing in Roblox Studio but it was when I actually played the game through the Roblox website.

But the problem is, when it says 6.5, that's supposed to be the ClockTime for 6:30, but the Text doesn't change at 6:30, it will only change at 7 to Before Class. I tried changing 6.5 to just 6, but that didn't work either. I also went all the way to 8:30 AM, but it didn't change to Classtime like it was supposed to either. I'm having a difficult time trying to troubleshoot this so if anyone can help, please let me know

Answer this question