Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this Loop that is not printing While i have no output error?

Asked by
hokyboy 270 Moderation Voter
4 years ago
local ElevatorPlayers = game.ReplicatedStorage.Players.PlayerValue.Value
local Liftsound = script.Parent.LiftSound
local Hitbox = script.Parent.Hitbox
local tp = workspace.tPoints:FindFirstChild("TpPoint")
Players = 0

-- PlayerValueGiver

local function AddPlayer()
    Hitbox.Touched:Connect(function()
        Players = Players + 1
        hit.Parent:moveTo(teleport.Position)
end)

-- Elevator Main

while true do
    wait()
    if Players >= 1 then 
        print("test")
  end
 end
end


0
why do you have 3 ends on the loop? You should only have 2 Benbebop 1049 — 4y
0
If i remove one it gives me an error hokyboy 270 — 4y

1 answer

Log in to vote
1
Answered by
Leamir 3138 Moderation Voter Community Moderator
4 years ago

Hello, hokyboy!

local ElevatorPlayers = game.ReplicatedStorage.Players.PlayerValue.Value
local Liftsound = script.Parent.LiftSound
local Hitbox = script.Parent.Hitbox
local tp = workspace.tPoints:FindFirstChild("TpPoint")
local Players = 0

-- PlayerValueGiver

local function AddPlayer()
    Hitbox.Touched:Connect(function()
        Players = Players + 1
        hit.Parent:moveTo(teleport.Position)
    end -- This end was at the wrong location...
end)

-- Elevator Main

while true do
    wait()
    if Players >= 1 then 
        print("test")
    end
end


Don't forget that you have to close all functions on your code

Ad

Answer this question