Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI element blinking when walking on a part?

Asked by 4 years ago

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

01local Players = game.Players
02 
03local function Touched(hit)
04    local player = Players:GetPlayerFromCharacter(hit.Parent)
05    if player ~= nil then
06        player.PlayerGui.ScreenGui.TextButton.Visible = true
07    end
08end
09local function Away(hit)
10    local player = Players:GetPlayerFromCharacter(hit.Parent)
11    if player ~= nil then
12        player.PlayerGui.ScreenGui.TextButton.Visible = false
13    end   
14end
15 
16script.Parent.Touched:Connect(Touched)
17script.Parent.TouchEnded:Connect(Away)
0
try deleting the away function because when you hit the block, it acts like the player keeps on jumping on it GameStealerKid 79 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

try deleting the away function because when you hit the block, it acts like the player keeps on jumping on it. so, put block around it with the away function so basically it would be like

Camera block script:

01local Players = game.Players
02 
03local function Touched(hit)
04    local player = Players:GetPlayerFromCharacter(hit.Parent)
05    if player ~= nil then
06        player.PlayerGui.ScreenGui.TextButton.Visible = true
07    end
08end
09 
10script.Parent.Touched:Connect(Touched)

Camera gui stopper (blocks around the camera block):

01local Players = game.Players
02 
03local function Away(hit)
04    local player = Players:GetPlayerFromCharacter(hit.Parent)
05    if player ~= nil then
06        player.PlayerGui.ScreenGui.TextButton.Visible = false
07    end
08end
09 
10script.Parent.Touched:Connect(Away)
0
thats such a good work around, thanks! Phantom_User101 17 — 4y
0
np GameStealerKid 79 — 4y
Ad

Answer this question