https://gyazo.com/caad2831a7d74a512f4078ceb13ff694
I am trying to do something like this in terms of the countdown time but I have no idea how to go about doing it.
I have a script that creates bool values inside of the Player to keep track of when they are pressed. I have a local script that makes sure the player is pressing a key and the server script it fires to changes the bool values inside of the Player. Additionally, I have a script that listens for when a bool value changes thus make the GUI's turn red, but I have no idea how I would go about showing the cooldown time. Any help would be greatly appreciated. My set-up is shown here:https://gyazo.com/bf7428503f532894c24b0a1b3db94ea5
Fire a local script with remote events whenever the timer starts. In one of the parameters you can put how long the cooldown is going to be, so the local script knows where to start it. Make another parameter to let the local script know which text to change. Oh and yeah, another one showing what the original text was.
Here's what the local script would look like:
local repStorage = game:GetService("ReplicatedStorage") local remoteEvent = repStorage:WaitForChild("RemoteEvent") remoteEvent.OnClientEvent:Connect(function(cooldown,textToChange,originalText) local text = script.Parent:WaitForChild(textToChange) -- Make sure to send the name of textToChange instead of the actual text itself, or else this probably wouldn't work. local counter = cooldown while true do if counter <= 0 then text.Text = tostring(counter) -- This sets the text of the key to press to the counter. counter = counter - 0.1 wait(0.1) else text.Text = originalText -- This sets the text back to normal after it reaches 0. end end end)
Server Script:
local repStorage = game:GetService("ReplicatedStorage") local remoteEvent = repStorage:WaitForChild("RemoteEvent") remoteEvent:FireClient(player,cooldown,text.Name,text.Text) -- Note that you're going to have to have the player as the first parameter when firing from a server script so that it knows which local player's local script to fire.
If you don't understand remote events, look at this video: https://www.youtube.com/watch?v=4Dc_bri9mjs