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

How To Make Touched Event Only Register One Touch?

Asked by 3 years ago

I want to register one touch on a part so I can put how many people have touched it on a GUI. Right now, it's registering 2 or 3 parts every time I touch it

local TPWallLeft = script.Parent.Parent.Parent
local Billboard = script.Parent.Parent
local PlayerGUI = script.Parent
local PlayerCount = Instance.new("IntValue")

TPWallLeft.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("HumanoidRootPart") then
        PlayerCount.Value = PlayerCount.Value + 1
    end
end)
wait(15)
print(PlayerCount.Value)
0
if u want to do that add a debounce TheUltimateTNTFriend 109 — 3y
0
for example when u do a touched add a value restricting more touches , then make a touchended that resets that value easy! TheUltimateTNTFriend 109 — 3y
0
thx i cant believe i didnt think of something as simple as that lol SuperSM1 67 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

TheUltimateTNTFriend solved it: just needed to add debounce lol

Ad

Answer this question