How do I I make this script with the "touchended" work?
Asked by
6 years ago Edited 6 years ago
I have the following script here, where there is a basepart "Push"
01 | ts = game:GetService( "TweenService" ) |
03 | push = script.Parent.Parent.push |
05 | weighted.CFrame = script.Parent.Parent.push.CFrame+Vector 3. new( 0 , 10 , 0 ) |
07 | left.CFrame = script.Parent.Parent.push.CFrame |
08 | stepped = ts:Create(push,ti,weighted) |
09 | unstepped = ts:Create(push,ti,left) |
11 | script.Parent.Touched:connect( function (a) |
12 | if a.Parent:FindFirstChild( "Humanoid" ) or a.Parent.Name = = "block" then |
17 | script.Parent.TouchEnded:connect( function (a) |
18 | if a.Parent:FindFirstChild( "Humanoid" ) or a.Parent.Name = = "block" then |
So the problem here is that in the script I want whenever a character or a model named "block" stop touching the block to play the animation "unstepped".
So here is the problem, I tried to let a model named "block" touch the block, but the animation doesn't play.
I think the issue here is that the returning object from ".touched" and ".touchended" is changing through more than one objects. Which is why the animation acts as if it is switching between two animations.
How could I fix this?
Alternatively, how do I make a weight activated button?