#why is my script weird?
1 messages · Page 1 of 1 (latest)
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.
first - your script is really hard to read
bc you don't use functions it looks so weird
ik
i seriously need to finish my game at all cost
i dont think 5 days doesnt drive anyone insane
right?
how
not smthing else
like
u can detect when player died
check his current team
and do any other team related things in one script
should i use values?
for?
i forgor
lol
i thought i was on something
🤓
** You are now Level 1! **
yea
but
btw the playercount is useless
tje game is about aliens vs humans
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
wdym
like
to have teams
you can parent players to a folder
or give them attribute
not rlly matter
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
you mean how many teams are there?
yes
workspace
wdym by that
there is no folders that say teams
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
i dont understand man
i know
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 
ok?
** You are now Level 2! **
so is there a script that adds teams like humans to this folder?
kinda
it's different script?
how do i say this
can you explain this like if i was like 5 years old
i'm trying bro
maybe its language barriers
i'm not sure
so
idk what to say
but
i'll recommend you to make this system work not using while true loop
how do i do that
i must make it
so everytime it detects with if
NO
you know connections?
like simplest one
workspace.part.Touched:Connect(function(part)
end)
wdym?
like youre trying to say something
ah
i know the touched:connect()
nice
i was trying to type this
so
you can do these connectons with many different objects
like humanoid
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
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
not from a while true loop
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?
how i do that
local allPlayersCount = #game.Teams.Humans:GetChildren()
see "#"
this will return number of items in table
so you don't need to count them
OH
typical sidequests
pairs
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?
idk
oh
i hope you're not iterating through all team children when single player dies
may be it works fine now
yeah
** You are now Level 3! **
this should be instant?
this is instant
instant like?
** You are now Level 6! **
may be instance?
every time character dies
character
and last connection disconnects
because humanoid getting destroyed
so this script will work forever
.
lol
you need to remove player from humans team when player dies
i already have an script that does that
and then call function to check number of players
and only then if there're 0 players do your msg
how 2 do that
you don't need to have many scripts that connected to the same thing
if allPlayersCount == 0 then function that do your msg
i dont know what path im going...
i remove the pairs then?
optimization of course
yes
use pairs to check attributes or states of items
and this too? if v.Team ~= game.Teams.Humans then
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
after player died?
yep
yes
thats why
** You are now Level 4! **
loading
let me restart discord
you can collapse all connections one by one
and see if you need to write end or end)
but it errors.
yes
they are necesarry
oh
you'll just get an error and script will not run
see?
you need to add end
and all will be fine
is it ok if i have no errors?
ofc
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)``

ignore ts
you should remove player from team
before cheching team count
and delete for loop
oh
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)```
how you did that?
wdym
just the same
how did you apply team to a player
do the same
but set team to aliens
or smthing you want to
send output
wain
can u look my stream on vc?
nvm i cant stream
there is no output
that mentions "hah"
is that ok?
eh
this is output
shit
discord being dumb
OH
nice
but if you want then ok
nah
yo..
?
imma send a video
i cant really explain it
btw lower volume
im on headphones
alright here
prepare ur ears
@random geyser
turn on output please
it's located in veiw > output
so you can see all prints from scripts
oh shit
btw i need print when you die
** You are now Level 7! **
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
** You are now Level 5! **
wth is hah
the code that has the script that detects if a team has 0 plr
wth is eggs
why are your lines uneven?
wdym
raaaaaaaaaaaahg
i promised my audience the game is coming on 5 hours...
i be really struggling
but im not forcing you.
are you sure that there're no other prints?
no
show them all then
how
here
sure
;_;
back on track ples
-
- im dumb
fr
ofc i can
bet
main works like
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
i dont want to share all my knowledge of development games for 8 years old children
bruh
how long do you making your game?
sadly
sadly what
wgt
This is a long thread, did the issue get resolved?
nah
yes
and the checking if there is 0 players
ig we keep yapping
Could you show me if anything comes up in dev console when you attempt the team swap?
ok
bro leave asap
his output is like
Hiroshima
or Nagasaki
Oof
I'll still see what I can do
I made a team swap system for a menu just last week
good
i made fully functional multi threading editable mesh
and tried to simulate ocean
I think I've heard of some projects like that, cool stuff
fr
idk
💬 Join PEAK Seas: https://discord.gg/peakworld
💬 Join PEAK Seas: https://discord.gg/peakworld
💥 A Salty Trip GAME LINK: https://www.roblox.com/games/100024919568581/A-Salty-Trip
🔴 Patreon (FUTURE TESTER): https://patreon.com/Dabidar
🤯 Join Channel Membership (FUTURE TESTER):
https://www.youtube.com/channel/UC0GCQ_YXptuAm9c3S...
but he made cool ocean + so cool formula
and also he made distance based waves
so his waves don't tile
Yeah that's dope stuff
don't try to script games with many systems at once
my first game was time stop jojo inspired game
and i made time stop
like sphere
and time movement
that's all
sadly
bye
what
?
AHHH
without payment of course
ok im giving up byeee
im lostt
yay
actually nvm
this is the only alive scripting server that actually answers

RAAAAAAAAAAAGH
aight
lets js focus on the main hole goal
boil soil coil
noid void zoid Pink Floyd
still open for you
i said ### and got muted for a minute
so what will happen?
** You are now Level 6! **
you have discord server?
how much people?
thats me
btw my name is xavie 💙 xavi
ignore = no life
my memory suddenly got wiped )Oh no(
oh yes
you should start working on my project
no no no
** You are now Level 8! **
spam LOL
...


kremit thej frod
adolf?
what to do?
oh right
js help on ts
cuz
i dont think anything is workIng.
.............................................................................
what's wrong here?
did you check the footage.
yes
the noises dont have loops.
i set it to false.
it still sound
mb you adding many sounds
so they are playing one by one
idk
check in explorer
i'm going to sleep
finally
still open

🍅 🍅 🍅 🍅
😷 😷 😷 🤿 🤿 🤿
can we be back on track or something
How
code?
This is your help
You will never use white true loops (I hope)
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)
?
wdym 0
This script will print 0
js polish your own polishing man
And some other useless words ofc
How
i need the game On.....................................................................................................................................................................................................................................
All should work fine
no it Doesnts
You don't get moved to aliens team when died?
I don't see prints in game
OH
I SEE WHY
ITS THE MAIN
BRUG
@random geyser
this was the thing looping the noises
took me long enough
no
Why
?

