#Hello I'm new to script and I need help with this simple script (not simple for me ._.).

1 messages · Page 1 of 1 (latest)

warm dome
#

Please do not make fun of my poor scripting skills as I just learned the fundamentals of scripting 3 days ago. Im trying to make a platform print something once two players are stepping it at the same time, yet I dont know how to make the script detect if the player has been added to the table. The script is also unfinished.

#

local Platform = script.Parent
local Status = 0
local plrs = {}

Platform.Touched:Connect(function(plr)
local plr = plr.Parent
local hum = plr.Parent:FindFirstChild("Humanoid")
Status = Status + 1
print(Status)
for i, v in pairs(plrs) do
table.insert(plrs, plr)
end
end)

while true do
repeat wait() until Status == 2
print("Enough players!")
end

#

help :/

lament stirrup
#
local Platform = script.Parent
local Status = 0
local plrs = {}

Platform.Touched:Connect(function(plr)
    local plr = plr.Parent
    local hum = plr.Parent:FindFirstChild("Humanoid")
    Status = Status + 1
    print(Status)
    for i, v in pairs(plrs) do
        table.insert(plrs, plr)
    end
end)

while true do
    repeat wait() until Status == 2
    print("Enough players!")
end
warm dome
#

Im trying to make a platform print something once two players are stepping it at the same time

lament stirrup
#

i havent really done that but

#

hmm

#

in

Platform.Touched:Connect(function(plr)
    local plr = plr.Parent
    local hum = plr.Parent:FindFirstChild("Humanoid")
    Status = Status + 1
    print(Status)
    for i, v in pairs(plrs) do
        table.insert(plrs, plr)
    end
end)
#

it seems like you never checked if it was actually a player

#

or a humanoid

warm dome
#

i see

lament stirrup
#

hum was never used

#

so if its touched, Status would stil lget added

#

*still

#

also

#

Use Status += 1

warm dome
#

I'm very new sorry for my lack of scripting knowledge btw

lament stirrup
#

atleast ur not the others

#

😭

warm dome
#

who would be the others sideeye

#

yes

#

somewhat

wicked raptor
#

uh

#

wait did you fix it already?