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

Tween Plays on Touch only works sometimes. Why?

Asked by 5 years ago
Edited 5 years ago

Hello everyone! I was working on my game today and it's a little bit like an obby. I have one platform that would appear shaky and will sink into lava upon touch.

How I did it was by having two tweens (Tween2 and Tween3) to shake the platform. And upon touch, it would play another tween (Tween4) to go down. After a few seconds, it would play a tween (Tween1) to go back up to the original position.

Sorry if the order of the tween names may be a little confusing.

Anyways, the issue is that when I touch the part, only sometimes does it stop shaking, does go down and back up and continue shaking. Sometimes it just doesn't register me from touching it. Script is placed in the platform.

Here is my code:

01local stick = script.Parent -- the platform
02local touched = script.Parent.numv - a number value. 0 is no touch and 1 is touch.
03local TweenService = game:GetService("TweenService") -- Get TweenService
04local TweenInf = TweenInfo.new(1) -- The TweenInfo
05local goal1 = {}
06goal1.Position = Vector3.new(-141.89, 32.927, 10.753-- The Goal For Tween1
07local goal2 = {}
08goal2.Position = Vector3.new(-140.49, 31.527, 9.353-- The Goal For Tween2
09local goal3 = {}
10goal3.Position = Vector3.new(-142.99, 34.027, 11.853) -- The Goal For Tween3
11local goal4 = {}
12goal4.Position = Vector3.new(-141.89, 10, 10.753) -- The Goal For Tween4
13 
14local Tween1 = TweenService:Create(stick, TweenInf, goal1) -- Create the tween
15local Tween2 = TweenService:Create(stick, TweenInf, goal2) -- Create the tween
View all 52 lines...
0
hey guys RoblotXRB 3 — 5y

Answer this question