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.
COMMUNITY QUESTION
how to make a timer bar and timer?
1 answer
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
