Hello there. I’m currently trying to make a dont press the button game.
I was working on a tsunami event where when you click the button, a small parkour stage appears, then a GUI will appear saying “watch out” and then the tsunami appears. I finished the tsunami and the parkour stage, I just can’t figure out how to make the textlabel appear.
Use a Remote
to fire all the clients the UI [with the text], and that should work.
After the tsunami has spawned, clone the UI to all players in your game, and add a delay [from the server], and when it ends, remove the UI.
Use GetPlayerFromCharacter
and get their PlayerGui
Did you make a TextLabel already or are you trying to make it from the script’s code?
I have already created it. (Need to have 30 letters)
Then you just need to fire a remote event on your server script to all clients, set this event on a local script to clone the UI then destroy it when your done with it.
So I’d assume you already have the button code, something like this should work! (Keep in mind, this is just pseudocode, and should be changed to fit your needs):
--/ Services
local Players = game:GetService('Players')
--/ Variables
local Button = workspace.Model.Button -- Change to the button location!
--/ Functions
local function DoMagic()
for _, Index in ipairs(Players:GetPlayers()) do -- Index is the current player!
local PlayerGui = Index:WaitForChild('PlayerGui') -- Get the player's PlayerGui!
local TsunamiGui = PlayerGui:WaitForChild('TsunamiGui') -- Change to the UI name!
TsunamiGui.Enabled = true
TsunamiGui.TextLabel.Text = 'Watch out!' -- Optional, also change to where the TextLabel is located, but if you don't need this option, remove this line!
task.wait() -- It's always good to add a wait to loops!
end
end
--/ Code
Button.MouseClick:Connect(DoMagic) -- Execute the function!