local part = script.Parent
part.Touched:Connect(fuction() print("touched") end)
part.TouchedEndded:Connect(fuction() print("touched removed") end)
if you try this script. if you walked in the part it will spam "touched" and "touched removed" at the same time, i want it to print once. like voting a map if you touched the part it will + the number once, if you touchendded it - the number once. please help!
local part = script.Parent touched = false -- global variable so it can be used everywhere in the script part.Touched:Connect(function() if touched == false then --checks if it has been touched before print("touched") end end) part.TouchedEnded:Connect(function() print("touched removed") end)
hopefully this works, I have corrected some of ur typos and added an if statement to check if it has been touched before.
local part = script.Parent debounce = false part.Touched:Connect(function(hit) if not debounce then debounce = true print("touched") wait(5) --waits 5 seconds before it you can print it again change it to whatever time you want debounce = false end end)
Hopefully This Helps.
local part = script.Parent local debounce = false part.Touched:Connect(fuction(hit) if debounce == false and hit.Parent:FindFirstChild("Humanoid") then -- checking if debounce is == true and if it finds the humanoid in the model humanoid is a property of the plr model so if it finds it it will find the "player" debounce = true-- setting it true so it wont be spammed print(hit.Parent.Name)-- prints the players name wait(5)-- cooldown for the block debounce = false-- making it false again so it will be able to work again end)