I am assuming that the script, you have mentioned is Local Script. I recommend you to use Server script instead because Local Scripts only work in StarterGui, StarterPlayerScripts and StarterCharacterScripts.
When you make this a script, just remove:
local Player = game.Players.LocalPlayer
Next, create a Remote Event in ReplicatedStorage of any name, for now, eg : RemoteEvent.
Now, instead of:
Player.PlayerGui.UniformGui.Frame.Visible=true
Do this,
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.RemoteEvent:FireClient(plr)
This is how your server script might look inside the part:
local function change(hit)
if hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.RemoteEvent:FireClient(plr)
end
end
script.Parent.Touched:Connect(change)
Now, lets set up the Local Script:
local Player = game.Players.LocalPlayer
local YourTime = 3
local d = false
if not d then
d = true
game.ReplicatedStorage.RemoteEvents.OnClentEvent:Connect(function()
Player.PlayerGui.UniformGui.Frame.Visible = true
end)
wait(YourTime)
d = false
end
Lemme know if it helps!