Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the value not changing??

Asked by 4 years ago

I'm trying to make a gui to host a sword fight thing and I'm adding a cooldown to prevent abuse and it's not changing the value. I've tried editing the code, putting it in serverscriptservice, in the gui, in workspace, none work.

game.ReplicatedStorage.CooldownStart.OnServerEvent:Connect(function()
    if game.ReplicatedStorage.FIghtStarted.Value == false then
        game.ReplicatedStorage.FIghtStarted.Value = true
        game.ReplicatedStorage.NameStorageDupe.Value = script.Parent.Parent.Parent.Name
        game.ReplicatedStorage.ParticipateFight:FireAllClients()
        game.ReplicatedStorage.Cooldown.Value = 520
        while true do
            game.ReplicatedStorage.Cooldown.Value = game.ReplicatedStorage.Cooldown.Value - 1
            wait(1)
            if game.ReplicatedStorage.Cooldown.Value == 0 then
                game.ReplicatedStorage.FIghtStarted = false 
                game.ReplicatedStorage.Cooldown.Value = 520
                break
            end
        end
    end
end)

Please help, is it where I'm putting it? It used to be just on mousebutton1up it runs but I tried changing it to OnServerEvent nothing is working

0
please use more variables this code is very messy. for example local FightStarted = game.ReplicatedStorage.FIghtStarted. WideSteal321 773 — 4y
0
It wasnt working when i used local but it works now so its fine AngryPlaayer 17 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

OOPS THIS ACTUALLY DOES WORK I JUST POSTED THIS BEFORE TESTING FBDIHFDSJ HFNSKLCM DJBNO

Ad

Answer this question