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

Welcome is not a valid member of PlayerGui?

Asked by
commag 228 Moderation Voter
5 years ago
debounce = false

script.Parent.Touched:Connect(function(hit)
if debounce == false then
if hit.Parent:FindFirstChild("Humanoid") then
Character = hit.Parent
Player = game.Players:GetPlayerFromCharacter(Character)
if Player.Backpack:FindFirstChild("Ticket") then
debounce = true
script.Parent.CanCollide = false
Welcome = Player.PlayerGui.Welcome
Welcome.Frame:TweenPosition(UDim2.new(.158,0,.767,0), 'Out', 'Back')
wait(5)
Welcome.Frame:TweenPosition(UDim2.new(.158,0,1.7,0), 'In', 'Back')
wait(1.5)
script.Parent.CanCollide = true
debounce = false
else 
TicketError = Player.PlayerGui.Ticket
TicketError.Frame:TweenPosition(UDim2.new(.158,0,.767,0), 'Out', 'Back')
wait(5)
TicketError.Frame:TweenPosition(UDim2.new(.158,0,1.7,0), 'In', 'Back')
end
end
end
end)

Whenever I run this script, I get an error saying that Welcome is not a valid member of PlayerGui. Welcome is in the StarterGui, so I can’t think of any issues it would run in to

0
Also sorry about no indentation! commag 228 — 5y

1 answer

Log in to vote
1
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

You are trying to access the ScreenGui from a server script. ScreenGuis cloned from StarterGui to PlayerGui are not replicated to the server, therefor you cannot use them from a server script.

You need to either use RemoteEvents to tell the client when to tween the gui or clone the gui from a server script into the PlayerGui, then it will be accessible by server, although it's a less recommended way.

0
Thought that might have been the issue, but I read somewhere it wasn’t necessary. Clearly misinformed. Thanks :) commag 228 — 5y
Ad

Answer this question