#Need help using a button more than one time then when die it resets
1 messages · Page 1 of 1 (latest)
idk
idk that bro im new to coding af
sameee...
Yo
Where is the code?
Maybe instead of connecting u did once
When player is clickign
so what u want to see
The script when u click on that gui
i currenctly have a part that enabels the power button
ok
use a lil youtube tut in there
@azure flume
ok
im done also if u do scripts i coul pay u
ive been trying to do this for a while
local player = game.Players.LocalPlayer
local button = script.Parent
local event = game:GetService("ReplicatedStorage"):WaitForChild("PowerEvent")
local screenGui = button:FindFirstAncestorOfClass("ScreenGui")
local cooldownLabel = screenGui:WaitForChild("CooldownLabel")
local powers = {
"Explosion", "BigHead","PushEveryone", "SpeedBoost",
"DropBlock","MagnetPull","InvisibleTrap","BulletJump","ConfettiBlast"
}
local cooldownTime = 15
local onCooldown = false
button.MouseButton1Click:Connect(function()
if onCooldown then return end
local canUseFlag = player:FindFirstChild("CanUsePower")
if not canUseFlag or not canUseFlag.Value then
warn("You must step on the PowerZone first!")
return
end
local chosenPower = powers[math.random(1, #powers)]
event:FireServer(chosenPower)
local powerLabel = screenGui:FindFirstChild("PowerLabel")
if powerLabel then
powerLabel.Text = "Power: " .. chosenPower
powerLabel.Visible = true
task.delay(2.5, function()
if powerLabel then powerLabel.Visible = false end
end)
end
onCooldown = true
button.AutoButtonColor = false
cooldownLabel.Visible = true
for i = cooldownTime, 1, -1 do
cooldownLabel.Text = "Cooldown: " .. i .. "s"
task.wait(1)
end
cooldownLabel.Visible = false
button.AutoButtonColor = true
onCooldown = false
-- Reset flag so they have to step on again
if canUseFlag then
canUseFlag.Value = false
end
end)
@azure flume
and also the on server event @void field
what
ya
can i get the script of what the server do?
** You are now Level 4! **
@azure flume
damn this one is quite long 😭
ik😭
whats pm😭
private message
ya
ResetOnSpawn is a property enabled by default on every screen gui