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

Why won't this script work?

Asked by
s_21 74
8 years ago

I joined FEAR, To test my script, And it still let me in.. Now I've quit FEAR, It doesn't let me in...

function createGui(player)
    local x = Instance.new("ScreenGui", player.PlayerGui)
    local frame = Instance.new("Frame", x)
    local label = Instance.new("TextLabel", frame)

    frame.Size = UDim2.new(1, 0, 1, 0)
    label.Size = UDim2.new(1, 0, 1, 0)
    label.FontSize = "Size48"
    label.Text = "You have been detected as a FEAR member. Quit FEAR to be able to play, because FEAR is for Is our arch enemy..."
    label.BackgroundColor3 = Color3.new(0, 0, 0)
    label.TextColor3 = Color3.new(1, 1, 1)
    label.TextWrap = true
end

game.Players.childAdded:connect(function(newb) 
    if newb:IsInGroup(72321) == true then

        repeat
        print("WAITING FER NEWB!  ")
        wait()
        until newb.Character ~= nil

        newb.Character:MoveTo(Vector3.new(0, 100000, 0))
        newb.Character.Torso.Anchored = true
        newb.Backpack:Remove()
        for index, gui in pairs(newb.PlayerGui:GetChildren()) do
            gui:Remove()
        end
        createGui(newb)
    else
        print("YOU'RE CLEAR!  ")
    end
end)

1 answer

Log in to vote
0
Answered by 8 years ago

It's because if newb:IsInGroup(72321) == true thenisn't true.

All you needed is if newb:IsInGroup(72321) then`

So to fix it,

function createGui(player)
    local x = Instance.new("ScreenGui", player.PlayerGui)
    local frame = Instance.new("Frame", x)
    local label = Instance.new("TextLabel", frame)

    frame.Size = UDim2.new(1, 0, 1, 0)
    label.Size = UDim2.new(1, 0, 1, 0)
    label.FontSize = "Size48"
    label.Text = "You have been detected as a FEAR member. Quit FEAR to be able to play, because FEAR is for Is our arch enemy..."
    label.BackgroundColor3 = Color3.new(0, 0, 0)
    label.TextColor3 = Color3.new(1, 1, 1)
    label.TextWrap = true
end

game.Players.childAdded:connect(function(newb) 
    if newb:IsInGroup(72321) then

        repeat
        print("WAITING FER NEWB!  ")
        wait()
        until newb.Character ~= nil

        newb.Character:MoveTo(Vector3.new(0, 100000, 0))
        newb.Character.Torso.Anchored = true
        newb.Backpack:Remove()
        for index, gui in pairs(newb.PlayerGui:GetChildren()) do
            gui:Remove()
        end
        createGui(newb)
    else
        print("YOU'RE CLEAR!  ")
    end
end)

2
IsInGroup returns a boolean, which is either true or false. So either comparison is valid. ScriptGuider 5640 — 8y
1
Right now I'm wondering if he just tested it in a live server, made sure it worked, the server stayed live because his friend was there or something, IsInGroup cached the result, he rejoined the server after leaving FEAR, then claimed it didn't work. That's the only way I see this script failing. M39a9am3R 3210 — 8y
0
My friend wasn't there, s_21 74 — 8y
Ad

Answer this question