-
What do you want to achieve?
My problem to be solved. -
What is the issue?
Scripting up aTouchedEvent
inside any of the parts of a tool cause teleportation (rapid, sudden movement). I believe the issues are related to the touch interest that is generated with the touch event. -
What solutions have you tried so far?
I have deleted the touch interest after the event is created but this disables the event entirely.
I tried to upload (multiple times) a video of the glitch but I encountered many errors. Hopefully, this has happened to someone before and whoever responds knows how to resolve this issue.
Script: (in case of questions about it)
local debounce = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent == workspace.Critters and not debounce then
debounce = true
script.Sound:Play()
--increase Critters
local character = script.Parent.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player then
local critters = player.playerDataFolder:WaitForChild("CrittersCollected")
if critters then
critters.Value += 1
end
end
wait(script.Sound.TimeLength/2)
hit:Destroy()
debounce = false
end
end)
Thanks in advance.