#How to end a round when reaching a number of crowns

15 messages · Page 1 of 1 (latest)

limber oyster
exotic nova
#

Every single time it adds a point to their total, add a conditional to see if they are at 25 crowns

limber oyster
#

how should i go about that

#

im not the greatest with scripting

#

while wait() do
wait(0.5)

if workspace.KingHills.King1.Owner.Value == script.Parent.Parent.Name then
    wait(1)
    local plr = script.Parent.Parent
    plr.leaderstats.Crowns.Value = plr.leaderstats.Crowns.Value + 1
end

end

#

this is the script i currently have

exotic nova
#

Couple nit-picks on the code

#

Instead of while wait() do wait(0.5) you can just do

#

While wait(0.5) do

#

And secondly

#
while wait() do
    wait(0.5)
    
    if workspace.KingHills.King1.Owner.Value == script.Parent.Parent.Name then
        wait(1)
        local plr = script.Parent.Parent
        plr.leaderstats.Crowns.Value = plr.leaderstats.Crowns.Value + 1
if plr.leaderstats.Crown.Value >= 25 then break -- here is where you can add a win effect

    end
end
limber oyster
#

so i should just copy this and put it in my script

twin frost
#

studio** You are now Level 1! **studio

limber oyster
exotic nova
#

If this isn't a local script, then yes