How can I make part touch Gui?

I’ve been having trouble lately learning how to make a part that a person can touch and a GUI appears im stuck on

Script.parent.Buy.Touched:Connect(function(Hit)

Please help!

1 Like

You can get the Player by using the GetPlayerFromCharacter function whenever the part gets hit, where Hit.Parent is referenced as the Character:

script.Parent.Buy.Touched:Connect(function(Hit)
    local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
    if Player then
        local PlayerGui = Player.PlayerGui
        PlayerGui.YourGuiHere.Enabled = true
    end
end)
2 Likes

I’ll try that thank you for commenting.

2 Likes

I never really heard of that function but I looked it up and it showed thank you.