Im trying to make it so when i stand on top of a part a text button is visible, and when i step off the part it becomes invisible, i tried this code (Server Script) and it kinda works but it blinks each time i move on the part, how can i make it so it doesnt blink? I also have a video of the issue so here is is, https://streamable.com/ypnkli
local Players = game.Players
local function Touched(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
player.PlayerGui.ScreenGui.TextButton.Visible = true
end
end
local function Away(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
player.PlayerGui.ScreenGui.TextButton.Visible = false
end
end
script.Parent.Touched:Connect(Touched)
script.Parent.TouchEnded:Connect(Away)

1 comment
try deleting the away function because when you hit the block, it acts like the player keeps on jumping on it