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

My gui is not appearing on a local script. Why?

Asked by 3 years ago

I am working on a movement gui that allows people to teleport. It works fine when the remote event is fired the first time, but when its fired another time, it stops turning visible, despite the workspace saying its visible. What is going on?

Local Script (In StarterCharacterScripts):

player = game.Players.LocalPlayer
character = player.Character or player.CharacterAdded:Wait()
humanoid = character:WaitForChild("Humanoid")
assignRoutes = game.ReplicatedStorage.Remotes.AssignRoutes
canPass1 = game.ReplicatedStorage.Remotes.CanPass1
canPass2 = game.ReplicatedStorage.Remotes.CanPass2
getWeapon = game.ReplicatedStorage.Remotes.GetWeapon
door1 = workspace.EmptyHouse.Door1.Closed
door2 = workspace.EmptyHouse.Door2.Closed
playerGui = player:WaitForChild("PlayerGui")
gui = playerGui:WaitForChild("BloxianPanel")
frame = gui:WaitForChild("EmptyHouseNavigation")
moveOn = frame:WaitForChild("MoveOn")

assignRoutes.OnClientEvent:Connect(function(path)
    print("Route Received")
    local route = path
    local index = 1
    local timer = 0
    humanoid.WalkSpeed = 0
    humanoid.JumpPower = 0
    character:MoveTo(route[index].Position)
    wait(15)
    moveOn.Visible = true

    moveOn.MouseButton1Click:Connect(function()
        timer = 0
        if index == #route then
            if route[index] == workspace.EmptyHouse.BloxianTeleports.DoorTeleports.Door1 then
                if not canPass1:InvokeServer() then
                    character:MoveTo(workspace.EmptyHouse.BloxianTeleports.JumpscareZone.Position)
                    humanoid.WalkSpeed = 16
                    humanoid.JumpPower = 50
                    getWeapon:FireServer()
                    moveOn.Visible = false
                    return
                else
                    index = 0
                end
            end

            if route[index] == workspace.EmptyHouse.BloxianTeleports.DoorTeleports.Door2 then
                if not canPass2:InvokeServer() then
                    character:MoveTo(workspace.EmptyHouse.BloxianTeleports.JumpscareZone.Position)
                    humanoid.WalkSpeed = 16
                    humanoid.JumpPower = 50
                    getWeapon:FireServer()
                    moveOn.Visible = false
                    return
                else
                    index = 0
                end
            end
        end
        index = index + 1
        character:MoveTo(route[index].Position)

        moveOn.Visible = false
        wait(8)
        moveOn.Visible = true

        while true do
            if moveOn.Visible == true then
                wait(1)
                timer = timer + 1
                if timer == 8 then
                    index = 1
                    character:MoveTo(route[index].Position)
                    break
                end
            else
                break
            end
        end
    end)
end)
0
you probably have a bug in your code that makes it so you need to reset LTRNightmare 66 — 3y
0
are you hiding to ui from sight by click the ui hid button. This might not be the case though. cocajola3 6 — 3y

1 answer

Log in to vote
-1
Answered by 3 years ago

Some simple errors people always make... 1. Not enabling the gui. 2. Not understanding how roblox functions when a game is run. 3. Its most likely an error with your code.

0
the output isn't showing any errors though torchmaster101 92 — 3y
0
Even if the output doesn't show errors your code may be wrong. THUNDER_WOW 203 — 3y
Ad

Answer this question