it’s bcuz you’re enabling the GUI from the starterGUI (which the player spawns with) instead of the playerGUI (the one you want to enable)
if hit.Parent:FindFirstChild('Humanoid') then
local playerGUI = game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui
playerGUI.ScreenGui.Frame.Visible = true
end
i recommend using a Remote Event, Remote event are useful to communicate between the server and client try this:
Part’s Script:
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local part = script.Parent
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Parent:FindFirstChildWhichIsA("Humanoid") then
RemoteEvent:FireClient(player)
end
end)
Local Script:
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local Frame = script.Parent.Frame
RemoteEvent.OnClientEvent:Connect(function()
Frame.Visible = true
end)