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

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

Asked by
zValerian 108
5 years ago

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!

0
You should be manipulating all guis client side. User#25115 0 — 5y
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 EmilyBendsSpace 1025 — 5y
0
@EmilyBendsSpace please respect all user. Don't laugh he's a beginner. NiniBlackJackQc 1562 — 5y
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. User#24403 69 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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

Ad

Answer this question