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

Why does my Frame doesn't appear on the players screen, but the Visible is = true?

Asked by 5 years ago

Im learning about filtering enabled, so i made this gui, that when you click on it sets a frame to appear, but it doesnt appear on the players screen when i click it, but when i go into the properties of the frame the Visible is set the true.

TextButton script:

script.Parent.MouseButton1Click:connect(function()
    game.ReplicatedStorage.Remote:FireServer()
end)

main script:

game.ReplicatedStorage.Remote.OnServerEvent:connect(function(player)
    Gui = game.StarterGui.ScreenGui.Frame
    Gui.Visible = not Gui.Visible
end)

i dont know that much of FE so ya.

2 answers

Log in to vote
1
Answered by
Lugical 425 Moderation Voter
5 years ago

The issue if you're trying to use the RemoteEvents is this: the PlayerGui is played on the client, not the server. To do this correctly, you won't even need the RemoteEvents, but rather, rewrite the code in a LocalScript.

script.Parent.MouseButton1Click:connect(function()
    script.Parent.Visible = true
end)

Hope this helps!

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Do you know the difference of the StarterGui and the PlayerGui?

StarterGui by ROBLOX WIKI

The StarterGui object is a service object that holds GUIs and LocalScripts. Children of this object get cloned into a Player's PlayerGui when their character spawns. If ResetPlayerGuiOnSpawn is false then the children will only be copied to PlayerGui the first time the player's character spawns.

PlayerGui by ROBLOX WIKI

The PlayerGui object is a container that holds a Player's user GUI. If a ScreenGui is a descendant of a PlayerGui, then any GuiObject inside of the ScreenGui will be drawn to the player's screen. Any LocalScript will run as soon as it is inserted into a PlayerGui. When a player first joins a game, their PlayerGui is automatically inserted into their Player object. When the player's Character spawns for the first time all of the contents of StarterGui are automatically copied into the player's PlayerGui. Note that if CharacterAutoLoads is set to false the character will not spawn and StarterGui contents will not be copied until LoadCharacter is called. If ResetPlayerGuiOnSpawn is set to true then every time the player's character respawns all of the contents of that player's PlayerGui is cleared and replaced with the contents of StarterGui.

For make this, you will not need to use RemoteEvent. Use LocalScript

script.Parent.MouseButton1Click:Connect(function() -- :connect() is obsolete, use :Connect
    script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible
end)

This is FilteringEnabled

0
oh User#23365 30 — 5y

Answer this question