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

:attempt to index local 'mainGui' (a nil value) ¿?

Asked by 5 years ago
Edited 5 years ago
local iosActive = false
local iphone = false
if userInputService.TouchEnabled and not userInputService.KeyboardEnabled then
    iosActive = true
    local gui = Instance.new("ScreenGui")
    gui.Parent = script.Parent
    local originalMainGui = script.Parent:FindFirstChild("MainGui")
    if originalMainGui then
        originalMainGui:Destroy()
    end
    local mainGui
    if gui.AbsoluteSize.X >= 1000 and gui.AbsoluteSize.Y >= 700 then
        mainGui = game:GetService("ReplicatedStorage"):WaitForChild("Tablet"):Clone()
        mainGui.Name = "MainGui"
        mainGui.Enabled = true
        mainGui.Parent = script.Parent
    else
        local mainGui = game:GetService("ReplicatedStorage"):WaitForChild("Phone"):Clone()
        mainGui.Name = "MainGui"
        mainGui.Enabled = true
        mainGui.Parent = script.Parent
        iphone = true
    end
    gui:Destroy()
else
    script.Parent:WaitForChild("MainGui").Enabled = true
end
0
¿? Alan_Vargas3110 -5 — 5y
0
Explain more lol, where is the error, why do you have the upside down questionmark and a normal questionmark?? TheOnlySmarts 233 — 5y
0
He tells me that the error is on line 12 in if gui.AbsoluteSize.X >= 1000 and gui.AbsoluteSize.Y >= 700 then Alan_Vargas3110 -5 — 5y

Answer this question