Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does it say that this screengui is not a part of playergui when it is?!

I am am making a script that when you press something, a textbutton pops up and a imagelabel closes. However, it says that it is not a part of the player gui. Here is my script:

game.Players.PlayerAdded:Connect(function(playerr)
game.ReplicatedStorage.ex1.OnServerEvent:Connect(function(player)
	print(player)


local c = "Welcome to the F18 Immunity Challenge! "
game.ReplicatedStorage.ex:FireAllClients(player, c)
playerr.PlayerGui.ex.TextButton.Visible = false
wait(10.2)
end)
end)

This is the error: https://gyazo.com/d2b270d761ec9f7c45be8a9fe842b7ab

Here is proof it is in gui:

https://gyazo.com/4f758831305b1d977e98a1e1fcb0b43c

Please help!

4 comments

0

You should be manipulating all guis client side.

0

Sweet cuppin' cakes son, do you really want bind a FireAllClients() to each player so that it fires N^2 times? When you have to misspell player to close over it twice, you should think "is this really what I want?" XD

0

@EmilyBendsSpace please respect all user. Don't laugh he's a beginner.

0

She is not laughing at him. Why is the event nested inside a PlayerAdded anyways and why in the world is the server even touching a GUI.

1 answer

✓ Accepted answer

Hi zValerian! I'm here to explain you why that not work. It's simple, you can't change a client element with the server. So for fix this, create a LocalScript and write this.

local PlayerService = game:GetService('Players')
local Player = PlayerService.LocalPlayer

game.ReplicatedStorage.ex.OnClientEvent:Connect(function()
	Player.PlayerGui.ex.TextButton.Visible = false
end)

and in your ServerScript delete this

playerr.PlayerGui.ex.TextButton.Visible = false

Because it's not possible

If it's not this so explain me what do you create

This discussion is preserved as it was. New answers, comments, and votes are closed.