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
You are trying to access the ScreenGui
from a server script. ScreenGui
s 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 RemoteEvent
s 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.