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

help i can't fix this problem using touched and touchendded is it really not working???

Asked by 5 years ago

Script

1local part = script.Parent
2 
3part.Touched:Connect(function()
4    print("Player is in")
5end)
6 
7part.TouchEnded:Connect(function()
8    print("player is out")
9end)

so my problem here is, if i walked in the part it spam print both the touched and touchendded. if i don't walk it doen't print anything, i want it to print once if the player is inside the block. and i want it also to print once if the player is outside the block. after this is solved im going to make map voting. --------//if you can't understand this! im saying is if i walked to the part it spam print the touched and touchendded for some reason. i want it to print once.

1 answer

Log in to vote
0
Answered by 5 years ago

This should work.Don't hesitate to tell me if you got any errors.

01local part = script.Parent
02local DebounceEnter = false
03 
04part.Touched:Connect(function()
05if DebounceEnter == false then
06DebounceEnter = true
07    print("Player is in")
08end)
09 
10part.TouchEnded:Connect(function()
11if DebouncEnter == true then
12DebounceEnter = false
13    print("player is out")
14end)
0
still doesn't work i fixed all your Error ImAnonymousBan 24 — 5y
0
still spam print both ImAnonymousBan 24 — 5y
Ad

Answer this question