ScreenGui not Appearing on Queue

I’m working on a project where the player has to push a ball into a designated area in order to win. However, the “Winner!” ScreenGui message won’t appear. Here is the StarterGui layout:
GuiImage
Here’s the code I used:

script.Parent.Touched:Connect(function(hit)
	hit:FindFirstChild("Ball")
	game.StarterGui.WinGui.WinLabel.Visible = true
	hit.Position = Vector3.new(5,8,-22)
	hit.Velocity = Vector3.new(0,0,0)
	hit.RotVelocity = Vector3.new(0,0,0)
end)

The reason I used hit:FindFirstChild is because "Ball" is an ObjectValue in the… Ball. Anyways, here’s the result:


See? WinLabel did not appear like it should have. Everything else works perfectly though. If possible, can you explain why WinLabel did not appear?

Did you mean the PlayerGui and not the StarterGui?:

game.Players.LocalPlayer.StarterGui.WinGui.WinLabel.Visible = true

Oh, I see. I’ll get to work and see if that works!

Edit: No offense or anything, but that only made things worse. Now the ball won’t even go back to its original position.


Here’s the code:

script.Parent.Touched:Connect(function(hit)
	hit:FindFirstChild("Ball")
	game.Players.LocalPlayer.StarterGui.WinGui.WinLabel.Visible = true
	hit.Position = Vector3.new(5,8,-22)
	hit.Velocity = Vector3.new(0,0,0)
	hit.RotVelocity = Vector3.new(0,0,0)
end)

Your problem is that Player dont see the starterGui. all ingredient in startergui goes to Player and name is PlayerGui you should Try to PlayerGui

You should find the player that has touched the ball as well, then use that user for

player.PlayerGui.WinGui.WinLabel.Visible = true

you Should Use this

function onTouched(hit)
local humanoid = hit.Parent:findFirstChild(“Humanoid”)
if humanoid~=nil then
game.Players:FindFirstChild(humanoid.Parent.Name).PlayerGui.WinGui.WinLabel.Visible = true
end
end

script.Parent.Touched:connect(onTouched)