So I want know how to make a countdown command gui because I really need it.
I was working in a lot of ways for to do this project but due to I don’t know how use properly “msg” functions, It’s too hard for me make it.
So please, I need help.
Thanks.
[My apologies, I don’t have any screenshot avaliable to show my project at the moment.]
Yes, I want be able to choose the time using msg event, but sadly I don’t know about that function yet, so I was asking for assistance.
I don’t need the full script, I want like an example.
Many admin models that are available allow you to insert your own commands into their existing framework. If you want to use your own thing, I’d start off with following @xMax_yy’s structure.
In order to get a number to be parsed from the 2nd half of the command, I’d suggest you do something like string.split(msg, " ") which would split up the message into different segments like the main command being run and the arguments that follow.
It’s recommended that you start off with the basics instead of just jumping straight in. Try starting off with a simple Chatted event connected to a function that prints what the player typed and build off of that by adding the if statement. If the command checkouts then execute your countdown function and turn the 1st argument of your command (which can be found as the 2nd entry from the string.split() function’s result) into a number using tonumber. If you’re unsure of how to do these things, be sure to take some time learning the fundamentals of Lua because you need those basic skills to create what you’re asking. It’s hard to give an example for your task without giving you the full script.
This is just a function, what he needs is the event, which is this:
local Admins = {USERIDSHERE}
local Prefix = ":"
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
local Admin = table.find(Admins, Player.UserId)
local Args = string.split(msg," ")
if (Args[1] == prefix.."countdown") and (Admin ~= nil) then
local CountdownValue = tonumber(Args[2])
while CountdownValue > 0 do
CountdownValue = CountdownValue - 1
wait(1)
end
end
end)
end)
Note: I wrote this up a bit quickly so there may be some overlooked errors.
I sadly do not have the time to write a script for you at the moment, however I can give you some suggestions on how I would do it.
You would need to have a .Chatted function on the player that would check if characters 1 through 11 (for example) are :countdown with a space after it, you would do this using the string.sub() function. You would then take the (for example) 12th character, using the string.sub function and convert it to a number using the tonumber() function.
You could then use a RemoteEvents and use the RemoteEvent:FireAllClients() function to fire everyone in the server’s client and send the information to a LocalScript. You would then make your UI and add a function to receive whenever the event is fired (RemoteEvent.OnClientEvent:Connect(function()) with the same arguments that you fired it with.
Once you have received the information needed and have a base for your GUI, you could use a for do loop to loop through the numbers, while going down by -1 and repeat the specific code that you’d like to repeat for each number. (This loop would wait 1 second at the start or end of it.)