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

Why will my Hide & Seek script not start?

Asked by
epoke466 100
3 years ago

I'm having a problem with this script, but I don't know where I went wrong...

repeat
    local P = 0
    for i, player in print(game.Players:GetPlayers()) do
        P = P + 1
    end
until P >= 2

local Players = {}

for i, player in pairs(game.Players:GetPlayers()) do
    table.insert(Players, player.Name)
end

local PlayerChosen = Players[math.random(1, #Players)]

local Hiders = Players
table.remove(Hiders, PlayerChosen)

local Seeker = PlayerChosen

function SeekPlr()
    local PlayerFound = game.Players:FindFirstChild("Seeker")
    return PlayerFound
end
--it doesn't get to this part
for i, player in ipairs(Hiders) do
    local Hider = game.Players:FindFirstChild(player)
    local Gui = script.PickerGui:Clone()
    Gui.Parent = Hider
    Gui = Hider.PickerGui
    Gui.Background.RoleGiven.Text = "Hider"
    Gui.Background.RoleGiven.TextColor3 = Color3.new(0.352941, 0.807843, 1)
    Gui.Background.Position = Gui.Background:GetAttribute("StartPosition")
    Gui.Background:TweenPosition(Gui.Background:GetAttribute("MiddlePosition"), Enum.EasingDirection.In, Enum.EasingStyle.Quint, 2)
    wait(3)
    Gui.Background:TweenPosition(Gui.Background:GetAttribute("EndPosition"), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 2)
    local Alive = Instance.new("Folder", game.ServerStorage)
    Alive.Name = "HidersAlive"
    local value = Instance.new("IntValue", Alive)
    value.Name = player
    Hider.Character.Humanoid.Died:Connect(function(PlayerDied)
        Alive:FindFirstChild(PlayerDied.Name):Destroy()
    end)
end

local Gui = script.PickerGui:Clone()
Gui.Parent = SeekPlr()
Gui = SeekPlr().PickerGui
Gui.Background.RoleGiven.Text = "Seeker"
Gui.Background.RoleGiven.TextColor3 = Color3.new(1, 0.152941, 0.152941)
Gui.Background.Position = Gui.Background:GetAttribute("StartPosition")
Gui.Background:TweenPosition(Gui.Background:GetAttribute("MiddlePosition"), Enum.EasingDirection.In, Enum.EasingStyle.Quint, 2)
wait(3)
Gui.Background:TweenPosition(Gui.Background:GetAttribute("EndPosition"), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 2)

script:FindFirstChildOfClass("Tool"):Clone().Parent = SeekPlr().Backpack

local Timer = Instance.new("Hint", workspace)
local Number = 120

local PlayersLeft = nil
local Winner = nil

while wait(1) do
    Number = Number - 1
    Timer.Text = Number
    PlayersLeft = 0
    for i, Value in pairs(game.ServerStorage.Alive:GetChildren()) do
        PlayersLeft = PlayersLeft + 1
    end

    if PlayersLeft == 0 then
        Winner = "SeekerWin"
        break
    elseif Number <= 0 then
        Winner = "HiderWin"
        break
    end

end

if Winner == "SeekerWin" then
    print("Yes!!!!!!!!!")
else
    print("U Suck!!!")
end

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

You put the GUI inside the player's object. You have to put it in the PlayerGui.

Around line 29

 local Hider = game.Players:FindFirstChild(player)
 local Gui = script.PickerGui:Clone()
 Gui.Parent = Hider.PlayerGui

The PlayerGui folder is where all the GUI stuff of the player is located

0
Im Stupid, thanks! epoke466 100 — 3y
Ad

Answer this question