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

Why the Text doesn't go away when I'm not standing on it anymore?

Asked by 8 years ago

Here is the script: local debounce = false

function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end

function onTouch(part)

local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then

debounce = true

local player = getPlayer(human)

if (player == nil) then return end

script.Parent:clone().Parent = player.PlayerGui

wait(2) debounce = false end end

script.Parent.Parent.Touched:connect(onTouch)

0
Please place your code in a code block and explain your issue more thoroughly. M39a9am3R 3210 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

well you have nothing telling it to remove the text.

local debounce = false

function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end

function onTouch(part)

local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then

debounce = true

local player = getPlayer(human)

if (player == nil) then return nil end

local v = script.Parent:clone()
v.Parent = player.PlayerGui

while wait(0.1) do
if (player.Character.Torso.CFrame.p-script.Parent.Parent.CFrame.p).magnitude<2 then
v:Destroy()
 debounce = false 
            end 
        end
    end
end

script.Parent.Parent.Touched:connect(onTouch)

-- this should work fine now aslong as everything you have done was right
0
Explain what you've changed and how the script works. M39a9am3R 3210 — 8y
Ad

Answer this question