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

Why aren't my textbox guis appearing after the first textbox?

Asked by 5 years ago
Edited 5 years ago

I made a script that makes gui visible after touched by a part and I made it so each frame contains textboxes that appear after another but after the first textbox appears, the rest don't work. Why isn't it working?

local Part = script.Parent

Part.Touched:Connect(function(HIT)
    local H = HIT.Parent:FindFirstChild("Humanoid")
    if H then
        wait(5)
        local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
        Player.PlayerGui.ScreenGui.Frame.Visible = true
        wait(10)
        Player.PlayerGui.ScreenGui.Frame.Visible = false
        wait(5)
        Player.PlayerGui.ScreenGui.Frame2.Visible = true
        wait(2)
        Player.PlayerGui.ScreenGui.Frame2.Visible = false
    end
end)

P.S. the script came from a part that makes these guis visible and localscript has nothing to do with this question

1 answer

Log in to vote
0
Answered by 5 years ago

You cannot access descendants of Player.PlayerGui from the server since these are local instances and are non-existent to the server. To fix this, you will have to use a RemoteEvent and use that to change your UI on the client. I'm not entirely sure why the first frame wouls become visible, but moving it as a whole to the client is a sure fix.

0
where do i put the remote event User#30241 0 — 5y
0
and how do i use it for ui changing? User#30241 0 — 5y
Ad

Answer this question