#why is my script weird?

1 messages · Page 1 of 1 (latest)

amber eagle
#

what i want to do is that when there is 0 players on a team an event happens, then after that event happens (5 seconds later) all players will get transfered into a team.

random geyser
#

first - your script is really hard to read

#

bc you don't use functions it looks so weird

amber eagle
#

ignore this btw

random geyser
#

ik

amber eagle
#

i seriously need to finish my game at all cost

#

i dont think 5 days doesnt drive anyone insane

#

right?

random geyser
#

yea

#

but

#

why while loop?

#

not connection

amber eagle
#

how

random geyser
#

not smthing else

#

like

#

u can detect when player died

#

check his current team

#

and do any other team related things in one script

amber eagle
#

???

#

wait hold on

#

cant i just use values

random geyser
#

but you call check for ALL players

#

to check their team

#

and so on

amber eagle
#

should i use values?

random geyser
amber eagle
random geyser
#

lol

amber eagle
#

i thought i was on something

random geyser
#

🤓

amber eagle
#

also uh

#

since i barely know coding

#

i might know why the scripts dont work

misty canyonBOT
#

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

random geyser
#

yea

amber eagle
random geyser
#

but

amber eagle
#

btw the playercount is useless

random geyser
#

can you explain how your team system works?

#

yes

amber eagle
#

so when the intermission ends

#

a random player dies

#

then becomes an alien

#

and all humans get teleported into the human base

#

and when a human dies

#

they become alien

#

(now in the main part, ignore the top text)

#

when all humans die

#

an even will happen

#

after 5 seconds of that event

#

all player's team will be merged into human's team

#

since everyon is alien

#

like humans vs zombies by homer mafia

random geyser
#

okay

#

but what "team" is

#

folder

#

or attribute

amber eagle
#

wdym

random geyser
#

like

#

to have teams

#

you can parent players to a folder

#

or give them attribute

#

not rlly matter

amber eagle
#

io dont know how to make that

#

i kind of know coding

#

like i know like 30 different words for make something work

#

so yea

#

i totally dont know what youre talking about

random geyser
#

okay

#

then tell me what's teams here

#

game.Teams i mean

amber eagle
#

you mean how many teams are there?

random geyser
#

nonono

#

you have explorer right?

amber eagle
#

yes

random geyser
#

here lots of folders

#

serverscript service

amber eagle
random geyser
#

workspace

amber eagle
#

wdym by that

random geyser
#

and one of all folders is "Teams"

#

yes?

amber eagle
#

there is no folders that say teams

random geyser
#

how then you trying to get it here

#

you can get like

#

game.ReplicatedStorage

#

or

#

game.ServerStorage

#

or game.Workspace

#

so you should have Teams folder

amber eagle
#

i dont understand man

random geyser
#

explorer

#

all these folders or containers ae parented to the "game"

amber eagle
#

i know

random geyser
#

so you can say

#

game.ServerScriptService

#

and you'll ger serverscriptservice

#

but when you try to get game.Teams

#

and there're no Teams in explorer

#

then you'll get an error

#

right?

#

oh shit

#

i found it crying

amber eagle
#

ok?

misty canyonBOT
#

studio** You are now Level 2! **studio

random geyser
#

so is there a script that adds teams like humans to this folder?

amber eagle
#

kinda

random geyser
#

it's different script?

amber eagle
amber eagle
random geyser
#

i'm trying bro

amber eagle
#

maybe its language barriers

random geyser
#

i'm not sure

#

so

#

idk what to say

#

but

#

i'll recommend you to make this system work not using while true loop

amber eagle
#

i must make it

#

so everytime it detects with if

random geyser
#

NO

#

you know connections?

#

like simplest one

#

workspace.part.Touched:Connect(function(part)

end)

amber eagle
#

oh

#

i know connections

#

but that type

#

what

#

what type

random geyser
#

wdym?

amber eagle
#

like youre trying to say something

random geyser
#

ah

amber eagle
#

i know the touched:connect()

random geyser
#

nice

random geyser
#

so

#

you can do these connectons with many different objects

#

like humanoid

amber eagle
#

oh

#

i think i asked to why is the script aint making all players go to an team

#

but ig we are doing side quests

random geyser
#

yes

#

cuz your script as you said weird

#
    
    plr.CharacterAdded:Connect(function(char)
        
        char.Humanoid.Died:Connect(function()
            
            
            warn("died")
            
            
            
            
        end)
        
    end)

end)```
#

so

#

here connection that fires every time any humanoid died

#

this is where you begin

amber eagle
#

btw

#

so

random geyser
#

not from a while true loop

amber eagle
#

oh wait

#

i think ur an genius

#

let me try

#

hold

#

on

#

how it works then

#

should i just put an value that lowers its value when a player dies or what?

random geyser
#

no

#

you can get table of players in team

#

like

amber eagle
#

how i do that

random geyser
#

local allPlayersCount = #game.Teams.Humans:GetChildren()

#

see "#"

#

this will return number of items in table

#

so you don't need to count them

amber eagle
#

OH

random geyser
#

typical sidequests

amber eagle
#

wait

#

i use it on ipairs?

random geyser
#

pairs

amber eagle
#

hold on

#

did you understand that when a round starts a random player dies

#

but when i test it

#

its one player?

#

so it means its working or not?

random geyser
#

idk

amber eagle
#

oh

random geyser
#

i hope you're not iterating through all team children when single player dies

amber eagle
#

*after i died

random geyser
#

may be it works fine now

amber eagle
misty canyonBOT
#

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

amber eagle
#

this is instant

random geyser
#

instant like?

misty canyonBOT
#

studio** You are now Level 6! **studio

random geyser
#

may be instance?

amber eagle
#

you made it when a player joins

random geyser
#

yes

#

instant

amber eagle
#

it detects if it dies

#

instantly

#

but not in a specific moment

#

how that work

random geyser
#

every time character dies

amber eagle
#

oh so

#

when a player resets it "adds"

random geyser
#

character

amber eagle
#

yes

#

ohh

#

i thought i was lot

#

lost

random geyser
#

and last connection disconnects

#

because humanoid getting destroyed

#

so this script will work forever

amber eagle
#

oh

#

but im kinda confused

#

since the script isnt "readable"

#

uhh

random geyser
#

lol

#

you need to remove player from humans team when player dies

amber eagle
#

i already have an script that does that

random geyser
#

and then call function to check number of players

#

and only then if there're 0 players do your msg

amber eagle
random geyser
amber eagle
#

im literally

#

my brain is like

#

sondkld ç¶n ib

random geyser
#

if allPlayersCount == 0 then function that do your msg

amber eagle
#

i dont know what path im going...

amber eagle
random geyser
#

optimization of course

random geyser
#

use pairs to check attributes or states of items

amber eagle
#

and this too? if v.Team ~= game.Teams.Humans then

random geyser
#

yes

#

you can use pairs to sort items

#

but here you have teams

#

sorted

#

and you don't need to check every player if he's in team

#

because he literally parented to a team

amber eagle
#

oh but

#

the message didnt show up

random geyser
#

after player died?

amber eagle
#

yep

random geyser
#

hmm

#

you have all connections?

amber eagle
#

yes

random geyser
#

palyeradded > charadded > hum.died

#

then

#

is your script yielded?

amber eagle
#

thats why

misty canyonBOT
#

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

amber eagle
amber eagle
#

also why there is an erro

random geyser
#

loading

amber eagle
#

i got 3 of them

random geyser
#

let me restart discord

#

you can collapse all connections one by one

#

and see if you need to write end or end)

amber eagle
#

but it errors.

random geyser
#

yes

amber eagle
#

so what

#

are the errors necesarry

#

or should i trust the proccess?

random geyser
#

they are necesarry

amber eagle
#

oh

random geyser
#

you'll just get an error and script will not run

#

see?

#

you need to add end

#

and all will be fine

amber eagle
#

is it ok if i have no errors?

random geyser
#

ofc

amber eagle
#

and

#

again

#

it is not working

random geyser
#

you can send full script

#

and i'll help

amber eagle
# random geyser you can send full script

local team = game.Teams.Humans
local Laugh = game.StarterGui.Laugh
game.Players.PlayerAdded:Connect(function(plr)

plr.CharacterAdded:Connect(function(char)

    char.Humanoid.Died:Connect(function()


        warn("died")
        local allPlayersCount = #game.Teams.Humans:GetChildren()
        local team = game.Teams.Humans
        local Laugh = game.StarterGui.Laugh

            local players = team:GetPlayers()

                    if #allPlayersCount == 0 then
                        print("Team is empty")
                        wait()
                        Laugh:Play()

                        local msg = Instance.new("Message",workspace)

                        msg.Text = "HAHAHHAHHH, ALL HUMANITY IN THE UNIVERSE HAS BEEN COMPLETLY WIPED BY ALIENS!! >:D"

                        workspace.Sound:Stop()


                        wait(5)
                        msg:Destroy()
                        workspace.Sound:Play()

                        for _, player in ipairs(players) do
                            player.Team = team 
                            wait()

                        end
                    else
                        print("Team has " .. #players .. " players")
                    end

                




    end)

end)

end)

#

``
local team = game.Teams.Humans
local Laugh = game.StarterGui.Laugh
game.Players.PlayerAdded:Connect(function(plr)

plr.CharacterAdded:Connect(function(char)

    char.Humanoid.Died:Connect(function()


        warn("died")
        local allPlayersCount = #game.Teams.Humans:GetChildren()
        local team = game.Teams.Humans
        local Laugh = game.StarterGui.Laugh

            local players = team:GetPlayers()

                    if #allPlayersCount == 0 then
                        print("Team is empty")
                        wait()
                        Laugh:Play()

                        local msg = Instance.new("Message",workspace)

                        msg.Text = "HAHAHHAHHH, ALL HUMANITY IN THE UNIVERSE HAS BEEN COMPLETLY WIPED BY ALIENS!! >:D"

                        workspace.Sound:Stop()


                        wait(5)
                        msg:Destroy()
                        workspace.Sound:Play()

                        for _, player in ipairs(players) do
                            player.Team = team 
                            wait()

                        end
                    else
                        print("Team has " .. #players .. " players")
                    end

                




    end)

end)

end)``

random geyser
amber eagle
#

bruh

#

wrong channel

amber eagle
random geyser
#

you should remove player from team

#

before cheching team count

#

and delete for loop

amber eagle
#

oh

amber eagle
#

\

random geyser
#
local team = game.Teams.Humans
local Laugh = game.StarterGui.Laugh



local function winMessage()
    
    print("Team is empty")
    wait()
    Laugh:Play()

    local msg = Instance.new("Message",workspace)

    msg.Text = "HAHAHHAHHH, ALL HUMANITY IN THE UNIVERSE HAS BEEN COMPLETLY WIPED BY ALIENS!! >:D"

    workspace.Sound:Stop()


    wait(5)
    msg:Destroy()
    workspace.Sound:Play()

    for _, player in ipairs(players) do
        player.Team = team 
        wait()

    end

end






game.Players.PlayerAdded:Connect(function(plr)

    plr.CharacterAdded:Connect(function(char)

        char.Humanoid.Died:Connect(function()


            warn("died")
            
            plr.Team = neutral -- idk do that somehow
            
            local allPlayersCount = #game.Teams.Humans:GetChildren()
            
            if #allPlayersCount == 0 then
                
                winMessage()
                
            else
                print("Team has " .. #allPlayersCount .. " players")
            end






        end)

    end)

end)```
#

change player's team properly on line 46

#

wait

#

pardon

#

few mistakes

#

done

#

shit

#

my bad

#
local team = game.Teams.Humans
local Laugh = game.StarterGui.Laugh



local function winMessage(allPlayersCount)
    
    print("Team is empty")
    wait()
    Laugh:Play()

    local msg = Instance.new("Message",workspace)

    msg.Text = "HAHAHHAHHH, ALL HUMANITY IN THE UNIVERSE HAS BEEN COMPLETLY WIPED BY ALIENS!! >:D"

    workspace.Sound:Stop()


    wait(5)
    msg:Destroy()
    workspace.Sound:Play()

    for _, player in ipairs(allPlayersCount) do
        player.Team = team 
        wait()

    end

end






game.Players.PlayerAdded:Connect(function(plr)

    plr.CharacterAdded:Connect(function(char)

        char.Humanoid.Died:Connect(function()


            warn("died")
            
            plr.Team = neutral -- idk do that somehow
            
            local allPlayersCount = #game.Teams.Humans:GetChildren()
            
            if #allPlayersCount == 0 then
                
                winMessage(allPlayersCount)
                
            else
                print("Team has "..allPlayersCount.." players")
            end






        end)

    end)

end)```
amber eagle
#

its Ok

random geyser
#

how you did that?

amber eagle
#

wdym

random geyser
#

just the same

#

how did you apply team to a player

#

do the same

#

but set team to aliens

#

or smthing you want to

amber eagle
#

i died..................................

random geyser
#

send output

amber eagle
#

can u look my stream on vc?

#

nvm i cant stream

#

there is no output

#

that mentions "hah"

#

is that ok?

random geyser
#

eh

#

this is output

#

shit

#

discord being dumb

#

OH

#

nice

#

but if you want then ok

#

nah

amber eagle
#

yo..

random geyser
#

?

amber eagle
#

imma send a video

#

i cant really explain it

#

btw lower volume

#

im on headphones

#

alright here

#

prepare ur ears

#

@random geyser

random geyser
#

turn on output please

#

it's located in veiw > output

#

so you can see all prints from scripts

amber eagle
#

i know.

#

there is no output that actually mentions the script;

random geyser
amber eagle
random geyser
#

oh shit

amber eagle
random geyser
#

btw i need print when you die

misty canyonBOT
#

studio** You are now Level 7! **studio

amber eagle
#

ok

#

wait

#

this could actually help you...

#

theres an script named main

#

that connects with hah

#

``local datatext = Instance.new("Hint",workspace)
datatext.Text = "-----------------------------------------------------------------------------------------Match-start-if-the-game-has-four-players!-----------------------------------------------------------------------------------------"
local playersR = game.Players:GetChildren()[math.random(1, #game.Players:GetChildren())]
local tper = workspace.HumanBase
wait(10)
while true do
if #game:GetService("Players"):GetPlayers() > 0 then

local thing = game.Lighting.Eggs:Clone()

    thing.Parent = workspace.EggSack
playersR.Character.Humanoid.Health = 0

datatext.Text = "-----------------------------------------------------------------------------------------Match-Started!-----------------------------------------------------------------------------------------"
game.StarterGui.Laugh:Play()
workspace.Sound:Stop()
    workspace.BackgroundMatch:Play()
tper.Script.Enabled = true
    script.Parent.Hah.Enabled = true

script.Disabled = true
wait(2)
-- script.Parent.Hah.Disabled = false

            tper.Script.Enabled = false

end
wait()

end
``

#

a random player dies, there is one player which makes it one player die cuz there is one plr

misty canyonBOT
#

studio** You are now Level 5! **studio

random geyser
amber eagle
random geyser
amber eagle
#

the eggsacl

random geyser
#

why are your lines uneven?

amber eagle
#

wdym

amber eagle
random geyser
#

raaaaaaaaaaaahg

amber eagle
#

i promised my audience the game is coming on 5 hours...

#

i be really struggling

#

but im not forcing you.

random geyser
random geyser
#

show them all then

amber eagle
#

how

random geyser
#

you said that you're unsure

#

or i'm just dumb

random geyser
amber eagle
#

we both are dumb

#

ur not alone

random geyser
#

sure

amber eagle
#

;_;

amber eagle
#

PFFT

#

😭

amber eagle
#

back on track ples

random geyser
#

hmm

#

we have 2 issues

#
    • your scripts are unreadable
#
    • i'm unsure
amber eagle
#
    • im dumb
random geyser
#

fr

amber eagle
#

alright

#

can you just

#

polish the script

random geyser
#

ofc i can

amber eagle
#

bet

random geyser
#

but there're other problem

#

idk how your other unpolished scripts work

amber eagle
#

loop while thing

#

if player.numplaryer < below 1 then

#

nvm

#

dont polish main

#

idk how to describe it

#

i wish we could switch brains

#

or memories

random geyser
#

for this

amber eagle
#

?

random geyser
#

i dont want to share all my knowledge of development games for 8 years old children

random geyser
#

how long do you making your game?

amber eagle
#

ive making this game for like 5 days straight

#

no rest

#

kinda of resting

random geyser
#

sadly

amber eagle
#

sadly what

random geyser
#

you made this for 5 days

#

all of these errors

#

what if you try to make a AAA game

amber eagle
compact whale
#

This is a long thread, did the issue get resolved?

random geyser
#

nah

compact whale
#

What exactly wasn't functioning as intended?

#

the team swapping?

amber eagle
#

and the checking if there is 0 players

#

ig we keep yapping

compact whale
#

Could you show me if anything comes up in dev console when you attempt the team swap?

random geyser
#

his output is like

#

Hiroshima

#

or Nagasaki

compact whale
#

Oof

#

I'll still see what I can do

#

I made a team swap system for a menu just last week

random geyser
#

good

#

i made fully functional multi threading editable mesh

#

and tried to simulate ocean

compact whale
#

I think I've heard of some projects like that, cool stuff

random geyser
#

fr

#

idk

#

but he made cool ocean + so cool formula

#

and also he made distance based waves

amber eagle
#

that has nothing to do with the thread

#

but ok

random geyser
#

so his waves don't tile

compact whale
#

Yeah that's dope stuff

random geyser
#

my first game was time stop jojo inspired game

#

and i made time stop

#

like sphere

#

and time movement

#

that's all

amber eagle
#

aight

#

imma just give up

random geyser
#

sadly

amber eagle
#

bye

random geyser
#

😦

#

bye

amber eagle
#

what

amber eagle
random geyser
#

sadly

#

i can give you a small job

amber eagle
#

AHHH

random geyser
#

without payment of course

amber eagle
#

DONT MENTION IT

#

THE J WORD

random geyser
#

NAAH

#

so no?

#

sadly again

amber eagle
#

ok im giving up byeee

#

im lostt

#

yay

#

actually nvm

#

this is the only alive scripting server that actually answers

random geyser
amber eagle
#

can u fix thi- GET OUT!

random geyser
#

RAAAAAAAAAAAGH

amber eagle
#

aight

#

lets js focus on the main hole goal

#

boil soil coil

#

noid void zoid Pink Floyd

random geyser
amber eagle
#

i dont want ###

#

dude

#

oh my goodness

#

2 hours left

#

dead end

random geyser
#

i said ### and got muted for a minute

random geyser
misty canyonBOT
#

studio** You are now Level 6! **studio

random geyser
#

you have discord server?

amber eagle
#

yup

#

and im not gonna promote it

random geyser
#

how much people?

amber eagle
#

like

#

uhh

#

its not really an audience but its

#

4 ppl

random geyser
#

fr

#

4

amber eagle
random geyser
#

AAHAHAHAHAHAHAHAHAHAH

amber eagle
#

Cornball

#

Now Get back to uh

#

idk

random geyser
#

😦

#

😭

#

wait

#

someone trying to hire me

amber eagle
#

thats me

random geyser
#

nooo way

#

do you want to explote roblox?

#

ahhhhhhhhhh

amber eagle
#

btw my name is xavie 💙 xavi

random geyser
#

wi-se-XAVI

#

yh

#

i see

random geyser
amber eagle
random geyser
#

hm

#

why are you asking?

amber eagle
#

my memory suddenly got wiped )Oh no(

random geyser
#

oh yes

amber eagle
#

OR ELSE...

random geyser
#

you should start working on my project

amber eagle
#

il get my neck trapped in a wooden thing

#

then get throwed tomatoes

#

Oh no!

random geyser
#

no no no

misty canyonBOT
#

studio** You are now Level 8! **studio

random geyser
#

you

#

need

#

to

#

game

amber eagle
#

spam LOL

random geyser
#

...

amber eagle
#

:sob]

random geyser
amber eagle
random geyser
#

spammers

amber eagle
#

no

#

gEt nacl tp work!

amber eagle
#

kremit thej frod

random geyser
#

adolf?

amber eagle
#

uhh

#

adolf h-cobain

random geyser
#

what to do?

amber eagle
#

oh right

#

js help on ts

#

cuz

#

i dont think anything is workIng.

#

.............................................................................

random geyser
#

what's wrong here?

amber eagle
#

did you check the footage.

random geyser
#

yes

amber eagle
#

the sound and laughing loops.

random geyser
#

set lopped to false

#

you can do so in explorer

amber eagle
#

the noises dont have loops.

random geyser
amber eagle
#

i set it to false.

random geyser
#

done then

#

all should work

amber eagle
#

it still sound

random geyser
#

mb you adding many sounds

#

so they are playing one by one

#

idk

#

check in explorer

#

i'm going to sleep

#

finally

random geyser
amber eagle
#

i dont want a job

#

OUCH

random geyser
amber eagle
#

dude pls...

#

i need to promise em

#

i dont wanna get tomatoes thrown at me...

random geyser
#

🍅 🍅 🍅 🍅

amber eagle
#

Please...

#

i cant Breathe

#

their egos are crushing me

random geyser
#

😷 😷 😷 🤿 🤿 🤿

amber eagle
#

can we be back on track or something

random geyser
#

How

amber eagle
#

code?

random geyser
#

This is your game

#

Your promises

amber eagle
random geyser
#

Your failure

#

Yh

amber eagle
#

nah but fr

#

i need help

#

on that code

#

and i complety

#

finish

#

the game

random geyser
#

You will never use white true loops (I hope)

amber eagle
#

Please....

#

Its been 3 hours...

random geyser
#

I can answer any questions

amber eagle
# random geyser I can answer any questions

can you answer local team = game.Teams.Humans
local Laugh = game.StarterGui.Laugh

local function winMessage(allPlayersCount)

print("Team is empty")
wait()
Laugh:Play()

local msg = Instance.new("Message",workspace)

msg.Text = "HAHAHHAHHH, ALL HUMANITY IN THE UNIVERSE HAS BEEN COMPLETLY WIPED BY ALIENS!! >:D"

workspace.Sound:Stop()


wait(5)
msg:Destroy()
workspace.Sound:Play()

for _, player in ipairs(allPlayersCount) do
    player.Team = team 
    wait()

end

end

game.Players.PlayerAdded:Connect(function(plr)

plr.CharacterAdded:Connect(function(char)

    char.Humanoid.Died:Connect(function()


        warn("died")

        plr.Team = game.Teams.Aliens -- idk do that somehow

        local allPlayersCount = #game.Teams.Humans:GetChildren()

        if #allPlayersCount == 0 then

            winMessage(allPlayersCount)

        else
            print("Team has "..allPlayersCount.." players")
        end






    end)

end)

end)
?

random geyser
#

Hmm

#

I think

#

0

#

If you mean what you should get in output

amber eagle
#

wdym 0

random geyser
#

This script will print 0

amber eagle
#

js polish your own polishing man

random geyser
#

And some other useless words ofc

random geyser
amber eagle
#

i need the game On.....................................................................................................................................................................................................................................

random geyser
#

Yea

#

How did you set player's team?

#

Just line

#

Of code

amber eagle
random geyser
#

NOT tHE WHOlE SCRIPt

amber eagle
random geyser
#

All should work fine

amber eagle
#

no it Doesnts

random geyser
#

You don't get moved to aliens team when died?

amber eagle
#

no?

#

bro

#

see the recording again omg

#

what is that attention span...

random geyser
#

I don't see prints in game

amber eagle
#

OH

#

I SEE WHY

#

ITS THE MAIN

#

BRUG

#

@random geyser

#

this was the thing looping the noises

#

took me long enough

random geyser
#

Cool

#

Now all systems work?

amber eagle
#

no

random geyser
#

Why

amber eagle
#

idfk

#

s[xf.x,dkkjfklld

random geyser
#

Famp

#

Hfd nh

#

HAtjnbxsygv

#

🥱 😴

#

🫃

#

My last words

amber eagle