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

GUI doesn't want to appear on the screen?

Asked by 5 years ago

Why doesn't it work. The rocket spawns but the GUI doesn't show.

script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Parent.RocketSelected.Value == 'Rocket1' then
        game.ReplicatedStorage:WaitForChild('Rocket1')
        local clone = game.ReplicatedStorage.Rocket1:Clone()
        clone.Parent = workspace
        game.StarterGui.ScreenGui.LaunchMenu.Visible = true
        game.StarterGui.ScreenGui.Screen.Visible = false
        game.StarterGui.ScreenGui.RocketMenu.Visible = false
    end
end)

1 answer

Log in to vote
2
Answered by
harstud 218 Moderation Voter
5 years ago
Edited 5 years ago

You can't access the startergui.

script.Parent.MouseButton1Click:Connect(function(plr)
    if script.Parent.Parent.RocketSelected.Value == 'Rocket1' then
        game.ReplicatedStorage:WaitForChild('Rocket1')
        local clone = game.ReplicatedStorage.Rocket1:Clone()
        clone.Parent = workspace
        plr = game.Players:GetPlayerFromCharacter(plr.Parent)
        plr.PlayerGui.LaunchMenu.Visible = true
        plr.PlayerGui.ScreenGui.Screen.Visible = false
        plr.PlayerGui.ScreenGui.RocketMenu.Visible = false
    end
end)

Ad

Answer this question