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

How do I make a watch?

Asked by 9 years ago

How do I make it so when I equip a certain tool it shows the time of day (not server time) in the bottom left. And when The tool is removed the Gui disappears?

2 answers

Log in to vote
2
Answered by 9 years ago

In order to make the time appear in the bottom-left corner of the screen, you will need to first create a GUI in Studio and place it in the StarterGui. Set the position to {0,0},{1,-GUI_HEIGHT}. You have to subtract the pixel height of the GUI to make it still visible on the screen.

Make sure to place the GUI in a ScreenGui object! You will also have to use the Equipped and Unequipped events. Sorry but the wiki removed the page about the Equipped event but it works the exact same way. I have provided a basic LocalScript to show you how this would work. Of course the GUI object and tool would have already needed to have been created beforehand. T

he LocalScript would be placed in the StarterGui or Backpack and the GUI would have to be invisible. The text you can set yourself whenever you would need to.

wait(1) -- waits for all player assets to prevent any errors from that
player = game.Players.LocalPlayer
tool = player.Backpack.Tool
gui = player.PlayerGui.ScreenGui.GUINAME

tool.Equipped:connect(function()
    gui.Visible = true
end)

tool.Unequipped:connect(function()
    gui.Visible = false
end)
0
Thanks :) Seeker5123 15 — 9y
0
I tested it and the script isn't doing its job... Seeker5123 15 — 9y
0
Nvm it worked :) (forgot to make the tool handle) Seeker5123 15 — 9y
0
You're welcome. FearMeIAmLag 1161 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago

SORRY i not dont read yout post gpood so i thught it was REAL time for some reason not ingame day time thanks god for the guy above me i didnt eould even relize so dont read and good luck sorry!

You'll need to use HttpService to get real time, from there

so you get the time with getasync, it's 20:12:31 with your clock script you add 1 second every second with loop, making sure once seconds reach 60 the minutes gets raised by 1 and then start again with the seconds adding up to 60 (same with the hours) so now the script got the real time, and is calculating the time from the time you got so maybe the script failed somehow and your 4 minutes behind real time call the getasync every 1 hour to make sure the script is calculating correctly

insert3 number values in a safe place where local scrpts can access it the 3 num values are seconds minutes and hours these get changed every seconds the clock script updates the time

so now we have the script that calculates real time make the tool, use Equipped to detect when the tool is equipped when it's equipped change the visibility of your gui to true

and now use Changed events on those 3 number values to detect when they are vhanged so from there you can get the seconds minutes hours

im onoob don thate

Answer this question