#game round system

1 messages · Page 1 of 1 (latest)

boreal zephyr
#

so im trying to make a round system where the players is teleported to the map when the match starts and teleported to the lobby again when the mtch ends... unfortunately, the only problem of my script is that, when the countdown comes to 0 (zero) the player is not teleported

local intermission = 10
local roundLength = 15

local InRound = game.ReplicatedStorage.InRound
local status = game.ReplicatedStorage.Status


InRound.Changed:Connect(function()
    
    if InRound.Value == true then
        
        for i, plr in pairs(game.Players:GetChildren()) do
            
            local char = plr.Character
            local humanRoot = char:WaitforChild("HumanoidRootPart")
            
            humanRoot.CFrame = game.Workspace.MapSpawn.CFrame
            
        end
        
    else

        for i, plr in pairs (game.Players:GetChildren()) do

          local char = plr.Character
          local humanRoot = char:WaitForChild("HumanoidRootPart")
          
          humanRoot.CFrame = game.Workspace.lobbyspawn.CFrame
        
        end  
    end    
end)



local function round()
    while true do
        
        InRound.Value = false
        
        
        for i = intermission, 0, -1 do
            
            status.Value = "Game Will Start in "..i.." seconds"
            
            wait(1)
            
        end
        
        InRound.Value = true
        
        
        for i = roundLength, 0, -1 do
            
            status.Value = "Game Will End in "..i.." seconds"
            
            wait(1)
            
        end
    end
end

spawn(round)
dull knoll
#

why is the player being moved twice in the script?

boreal zephyr
#

one from the lobby to the map where the match is going to happen

#

and the other when coming bacl from map to lobby

upbeat flint
#

bro in my game one of the pets has a 1/736k rarity and the number value is 0. but when i try it with another pet it just says 1/inf helpp plsssss

dull knoll
#

Wait nvm i can't read

upbeat flint
dull knoll
#

But okay so

boreal zephyr
dull knoll
#

is MapSpawn a single part?

boreal zephyr
#

yes

dull knoll
#

I see

boreal zephyr
#

does it affect a lot?

dull knoll
#

i hope not

#

I usually move players to different parts

#

not a single part

#

Wait can you send a screenshot of the code?

boreal zephyr
#

can i send ss here?

#

let me see..

dull knoll
#

i think so

boreal zephyr
#

first part of the script

#

@dull knoll

boreal zephyr
bleak barnBOT
#

studio** You are now Level 3! **studio

boreal zephyr
#

isnt a "different part" a single part?

dull knoll
dull knoll
boreal zephyr
#

oooooohhhh

#

i see

#

how would u do that tho?

dull knoll
#

Make a folder with the parts you want to move the players to. In a script, get the contents of that folder (getchildren() ) and then use for "i,v in pairs(players:GetPlayers()) do" loop

#

Wait give me a minute to check a few things of your script

boreal zephyr
#

alright alright

#

take ur time

#

help is appreciated haha

dull knoll
#

well

#

it seems to work for me

#

There's no errors in the output?

boreal zephyr
#

Nope

#

0 errors

dull knoll
#

Can you send a screenshot of your explorer? Showing the part that acts as the spawn?

#

Also try replacing the last line "spawn(round)" with
task.spawn(round)

boreal zephyr
boreal zephyr
dull knoll
boreal zephyr
#

sorry if im asking too much

#

im kinda new

dull knoll
#

Na it's not a problem at all

#

Yeah that's alright

#

I've been there

#

And i'm still kinda new too

boreal zephyr
#

so u know how it is huh

dull knoll
#

Yessir

boreal zephyr
#

for how long have u been scripting?

dull knoll
#

2 months lmao

boreal zephyr
#

Dang

#

And already helping

#

That’s crazy

dull knoll
#

yeaah

#

This is similar to yours

#

Only thing different is the spawn name and then how i call the services

#

try using game:GetService("ReplicatedStorage")

boreal zephyr
#

Let me seee

dull knoll
#

Alr

boreal zephyr
#

hold onnn

#

Found an error

dull knoll
#

What's it say?

boreal zephyr
#

“Waitforchild is not a valid member of Model “WorkSpace.Pittu_YTB”

#

Pittu_YTB is my username

#

Btw

dull knoll
#

the spelling

#

is important lmao

boreal zephyr
#

I’ll send a Ss

dull knoll
#

The case matters

boreal zephyr
#

Wait

dull knoll
#

Waitforchild and WaitForChild are different

boreal zephyr
#

So

#

OH

dull knoll
#

The last one is the correct one

boreal zephyr
#

MAAAHHH

#

THATS actually crazy tho

dull knoll
#

Yeah lmao it is

#

Gives me a lot of headache

boreal zephyr
#

I was tryna get cautious about that while I was doing it

#

And failed

dull knoll
#

Ah I see lol

boreal zephyr
#

Let me test

#

Still not working

#

But no error

dull knoll
#

I see

#

Reduce the intermission time and the round length time to like 5 seconds so we can see

boreal zephyr
#

Alright

#

U think that having a SpawnLocation, affects anything ?

bleak barnBOT
#

studio** You are now Level 4! **studio

dull knoll
#

Na it doesn't

boreal zephyr
#

The literal “SpawnLocation” Part

bleak barnBOT
#

studio** You are now Level 12! **studio

dull knoll
#

Nope it doesn't affect anything

#

Just make sure nothing's named the same is all

boreal zephyr
#

More errors

dull knoll
#

And also

local playersService = game:GetService("Players")

And then when you're using the "for i, plr in pairs() loop", inside the pairs() try using pairs(playersService:GetPlayers)

#

You can use different names for the variables, just make sure it all matches up

boreal zephyr
#

Even

#

Like

#

It has to be 100% equal , right ?

#

This is kinda rigorous now that I see

dull knoll
#

Yeahhh

boreal zephyr
#

It says lobbyspawn is not a valid member of WorkSpace “WorkSpace”
And
MapSpawn is not a valid member of WorkSpace “Workspace”

dull knoll
#

okay wait send me your code again, just the part where it says lobbyspawn = something something

boreal zephyr
dull knoll
#

Are the two parts anchored?

boreal zephyr
#

no...

dull knoll
#

I see

#

And also, use a variable to refer to the parts. Like

local mapSpawn = game.Workspace:WaitForChild("MapSpawn")

And similarly for the other spawn part

boreal zephyr
#

alright

dull knoll
#

So that the game actually waits for the parts to load and not get an error

boreal zephyr
#

let me try that

#

oh yeee it might work

dull knoll
#

The script might run before the parts load so that's why it errors

#

uh huh

dull knoll
boreal zephyr
dull knoll
#

did it work 🥺

boreal zephyr
#

Joining…

#

NOOOO

dull knoll
#

Any errors?

boreal zephyr
#

wait

#

Should I use the variable

#

Inside or out the function ?

dull knoll
#

Um yes?

#

Uh inside the function works

boreal zephyr
#

Tried both tho

#

None of them worked out

dull knoll
#

Wait hold on do you want to join on call, share your screen and show me?

#

YOu don't have to talk

#

neither will I

boreal zephyr
#

Hol dom

#

Hold on*

dull knoll
#

yeah

boreal zephyr
#

I think I’m closeeee

dull knoll
#

That sounds so wrong

boreal zephyr
#

😂😂

dull knoll
#

Well??

boreal zephyr
#

IMMA try once more

#

I’ll probably just hop on the call

dull knoll
#

Alr lmao

boreal zephyr
#

YOOOO

#

YOOOOOOO

#

IT WORKED

dull knoll
#

Aye sweet

boreal zephyr
#

IM SO FUCKIN HAPPY BRO

dull knoll
#

O_O

boreal zephyr
#

YOOO LETS GOOO

#

Btw

#

Do you already work in a game?

#

@dull knoll

dull knoll
#

My own yes

boreal zephyr
#

It’s working perfectly

dull knoll
#

Aye nice nice

#

Good

boreal zephyr
#

Thanks bro

#

Fr

dull knoll
#

Anytime yeah

#

If you need more help hit me up

boreal zephyr
#

Thanks thx