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

Why Does this Script with My SurfaceGui Not Work in FilteringEnabled?

Asked by
8391ice 91
7 years ago

Upon joining the game, a script waits for the player's Character to load and then adorns a SurfaceGui that is placed into his or her StarterGui beforehand to a part in the Workspace.

The script inside of the SurfaceGui which is in the Player's StarterGui:

repeat wait() until script.Parent.Parent.Parent.Character ~= nil
script.Parent.Adornee = game.Workspace.StartMenuArea.Room.Board

There is another script within it; an ImageButton in the SurfaceGui holds it. Upon clicking the ImageButton, it should print "Clicked."

The script inside of the ImageButton:

script.Parent.MouseButton1Click:connect(function()
    print("Clicked")
end)

When I test the game, the SurfaceGui is successfully adorned to the part in the Workspace. However, when I click on the ImageButton, "Clicked" is not printed. This confuses me because I thought that when FilteringEnabled was on, you didn't have to worry about using RemoteEvents and RemoteFunctions for the player's GUI, because it is client-sided. So why is this happening?

0
I already tried setting the ZIndex of the button to 10, and yet nothing changed. 8391ice 91 — 7y
0
Try game.Players.LocalPlayer.CharacterAdded:wait() instead of your repeat until RubenKan 3615 — 7y
0
I just did, and it didn't change anything. 8391ice 91 — 7y
0
A SurfaceGui would need the events connected using a local script then using a remote to process the users request. User#5423 17 — 7y
0
But why would I need to use remotes at all if the SurfaceGui is client-sided? 8391ice 91 — 7y

1 answer

Log in to vote
0
Answered by
Etheroit 178
7 years ago
Edited 7 years ago

Client cant access workspace!

Notes: - Use game.Players.LocalPlayer instead of script.Parent.Parent.Parent.Character, - I prefer using :WaitForChild() function, - Do the same thing on server side so it should work.

Ad

Answer this question