loads.Enabled = false
function partTouched(obj)
loads.Enabled = true
end
game.Workspace.fogFAVE.fogfave.Touched:Connect(partTouched)
im trying to make a screengui appear when a player touches a part. in another script, touching the part teleports them to a different game which works fine but the gui wont appear when the part is touched. here is the layout in explorer:
I would put the LocalScript inside of StarterPlayer → StarterPlayerScripts personally. Name it however you see fit and put the UI inside of StarterGui.
local part = workspace:WaitForChild("PartNameHere") -- Part that you touch
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
local gui = playerGui:WaitForChild("GuiNameHere") -- Name of the UI you want to become visible
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health > 0 then
local char = hit.Parent
local player = game.Players:GetPlayerFromCharacter(char)
if player == localPlayer then
gui.Enabled = true
end
end
end)
That’s the pseudocode for how it would function, not entirely sure if it’s bug proof (didn’t test it)