Hey, I made a big button and it can be triggered by a block touching it. Problem is touch and touchend is very very unreliable. Sometimes it doesn’t work and sometimes it does.
Here’s my current script
local RedPart = script.Parent
local TweenService = game:GetService("TweenService")
local First = RedPart.Parent.First
local Second = RedPart.Parent.Second
local Debounce = false
RedPart.Touched:Connect(function(BasePart)
if BasePart:GetAttribute("Box") and not Debounce then
Debounce = true
RedPart.Triggered:Play()
TweenService:Create(RedPart,TweenInfo.new(0.3,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out),{Position = Second.Position}):Play()
print("Box has stepped on trigger.")
wait(0.5)
Debounce = false
end
end)
RedPart.TouchEnded:Connect(function(BasePart)
if BasePart:GetAttribute("Box") and not Debounce then
Debounce = true
RedPart.Triggered:Play()
TweenService:Create(RedPart,TweenInfo.new(0.3,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out),{Position = First.Position}):Play()
print("Box stopped touching on trigger")
Debounce = false
end
end)
What i’m looking for, is a method of detecting this accurately and more reliable.
I’ve searched for touch and touch end alternatives but they don’t work for this type of scenario