Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

touched and touchendded once. no one can solve... please HELP?

Script

local part = script.Parent

part.Touched:Connect(fuction() print("touched") end)

part.TouchedEndded:Connect(fuction() print("touched removed") end)

so my problem is if i touch the part it spam both, Touched And TouchedEndded for some Reason. i want to do is if i touch the part it print once. and if i get off the block it print "touched removed" once. its like map voting!

2 comments

0

Never seen TouchEndded but I've seen TouchEnded

0

The word 'ended' has only 2 D's, not 3

1 answer

please for the sake of us indent ur code in the future cause its kinda hard to help u with code in a straight line like this but its fine since its a small amount.

local part = script.Parent
local db = false -- making a debounce bassicly a cooldown

part.Touched:Connect(fuction() 
if db == false then -- if db ~= false then it wont go further
db = true-- setting it true so it wont be spammed
print("touched") 
end)

part.TouchedEnded:Connect(fuction() 
db = false-- setting it false so when u leave the brick u can print it again
print("touched removed") 
end)

2 comments

0

yeah it doesn't work, for some reason the touched and touchended its broken lol. it print both at the same time! i really want to know what is the solution!

This discussion is preserved as it was. New answers, comments, and votes are closed.