Hello, im trying to make a script in which when you stand on top of a part it makes a text button appear. Its a local script and the directory of it is Workspace\Part\LocalScript, and the directory of the text button is StarterGui\ScreenGui\TextButton. Here is the code:
local player = game.Players.LocalPlayer
local function Touched(hit)
if hit.Parent:FindFirstChild("Humanoid") then
player.PlayerGui.ScreenGui.TextButton.Visible = true
end
end
script.Parent.Touched:Connect(Touched)

2 comments
have you tried debugging it by adding a print to every thread?
yes, i have but no prints work, not even before the local player variable