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

how to make a timer bar and timer?

Asked by 5 years ago

I want to make a timer and a bar so when someone hits a button timer count downs and a status bar shows how much time is left. if you can just guide me to where I can learn it I'm trying to learn scripting then having someone tell me what to type.

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago

This is quite simple, I cannot aid you to create the GUIs as that's your job, yet I will write you a Script, please follow the names of each object when I'm Scripting since I'm referencing to the GUI Object.

The main functionality of a "Status" bar is to have a Client listener.

--// LocalScript, put this in 'StarterPlayerScripts'
local Player = game:GetService("Players").LocalPlayer --// Get's access to your Player
local PlayerGui = Player:WaitForChild("PlayerGui") --// Get's access to the PlayerGui

Remember that StarterGui is a replication handler; don't try to configure GUIs from here, always the PlayerGui, whatever is from StarterGui will replicate to PlayerGui.

--// LocalScript, put this in 'StarterPlayerScripts'
local Player = game:GetService("Players").LocalPlayer --// Get's access to your Player
local PlayerGui = Player:WaitForChild("PlayerGui") --// Get's access to the PlayerGui
local StatusBar = PlayerGui:WaitForChild("StatusBar") --// Get's access to the StatusBar
local Status = StatusBar:WaitForChild("Status")
local function ChangeStatus() 
   StatusBar.Text = Status.Value
end
ChangeStatus()
Status("Value"):Connect(ChangeStatus) --// Runs 'ChangeStatus' whenever the StringValue of 'Status' changes

From here, you're done, you can use a ServerScript to change the Value of Status, which is a StringValue inside the StatusBar GUI

Ad

Answer this question