Tween:Cancel isn't working

I’ve been working on a dash system. (Thanks for the help with tweening on my other post with C frames!) It was clipping through the parts, and I fixed it. I did some further edits, broke the script, then reverted them. These print functions both work, which means the game does detect the colliding. Any fixes?

Tween:Play() 
		local touchedConnection = humanoid.Touched:Connect(function(hit, limb)
			wait(0.000000000000001)
			print ("Hit!")
			Tween:Cancel()
			print ("Hi000ferkfif3rf")
				HumanoidRootPart.Anchored = false
			end

Are you trying to stop a tween at its current time or reset is completely?

Either. Preferably reset though because this ends the dash upon collision. The tween is causing clipping so this system prevents it.

Do:

Tween:Reset()

I learnt that on .my programming course.

1 Like

Doing wait(.00000000000000001) can actually cause some serious problems, just use wait()

Read through this document. It won’t help with your script, but it’ll save you problems in future scripts :slight_smile:
https://blog.roblox.com/2012/05/using-wait-wisely/

2 Likes

Yeah that’s super useful. Typically that kind of thing is for loops though. I’m still gonna change it nonetheless though.

Right, the issue is, computers really can’t wait that little time, so it really causes a problem since the computer thinks it can. Glad it was useful :slight_smile:

1 Like

Agreed. I was going to suggest that.