Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to play a tween properly?

So I'm currently trying to make a potion for my game, and I want it to make the player's character bigger.

local TweenService = game:GetService("TweenService")
local tool = script.Parent
local drink = tool.Drink
local drinkSound = tool["Drink Sound"]
local triggered = false

local function onActivated()
	if not triggered then
		triggered = true
		
		drinkSound:Play()

		local character = tool.Parent
		local humanoid = character.Humanoid

		local animTrack = humanoid:LoadAnimation(drink)
		animTrack:Play()

		for i, v in pairs(character:GetChildren()) do
			if v:IsA("Part") then
				local info = TweenInfo.new(
					5,
					Enum.EasingStyle.Sine,
					Enum.EasingDirection.Out,
					0,
					false,
					0
				)

				local goals = {
					Size = Vector3.new(15, 15, 15);
				}

				local tween = TweenService:Create(v, info, goals)
			else
				-- ignore
			end
		end
		
		wait(1.5)
		triggered = false
	end
end

tool.Activated:Connect(onActivated)

For some reason, the tween I made doesn't play. Can somebody help me? Thank you.

1 answer

✓ Accepted answer

I think it's because you didn't play the tween, maybe try this, it's at line 34.

-- Line 34
local tween = TweenService:Create(v, info, goals)
tween:Play() -- Added this, 
else

This discussion is preserved as it was. New answers, comments, and votes are closed.