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

My tweening script for a portal doesn't play ?

I tried making a tween script for a portal but the tween didn't play script :

game.ReplicatedStorage.Event.Event:Connect(function()
	local ts = game:GetService("TweenService")
	local Portal = game.ReplicatedStorage.Portal:Clone()
	Portal.Parent = workspace
	Portal.Position = Vector3.new(math.random(-400,400),100,math.random(-400,400))
	local tween = ts:Create(
		Portal,
		TweenInfo.new(3,Enum.EasingStyle.Bounce, Enum.EasingDirection.Out,0,false,0),
		{Size = Vector3.new(60,60,60)}
	)
	tween:Play()
	Portal:WaitForChild("portal"):Play()
	wait(3)
	local object = game.ReplicatedStorage.Objects:GetChildren()[math.random(1,#game.ReplicatedStorage.Objects:GetChildren())]:Clone()
	object.Parent = workspace
	object.Position = Portal.Position
	game.ReplicatedStorage.ExplosionScript.Touched:Clone().Parent = object
	wait(1)
	local tween2 = ts:Create(
		Portal,
		TweenInfo.new(3,Enum.EasingStyle.Bounce, Enum.EasingDirection.In,0,false,0),
		{Size = Vector3.new(0.1,0.1,0.1)}
	)
	tween2:Play()
end)

1 answer

✓ Accepted answer

I tried your code and it kind of worked. I created a BasePart in ReplicatedStorage named Portal. I also edited some lines to make it look nicer.

local function playAnimation()
  local ts = game:GetService("TweenService")
  local Portal = game.ReplicatedStorage.Portal:Clone()
  Portal.Parent = workspace
  Portal.Position = Vector3.new(math.random(-400,400),100,math.random(-400,400))
end

local tweenInfo = TweenInfo.new(3,Enum.EasingStyle.Bounce, Enum.EasingDirection.Out) --I omitted the last three default values because it's the same
local tween = ts:Create(Portal, tweenInfo,{Size = Vector3.new(60,60,60)})
tween:Play()
--Portal:WaitForChild("portal"):Play() --Idk what this does
wait(3)
end

local PlayAnimationEvent = game.ReplicatedStorage:WaitForChild('PlayAnimationEvent')

PlayAnimationEvent.Event:Connect(playAnimation)

Since you are using an Event, I assume it's Server to Server. In the other server script:

local PlayAnimationEvent = game.ReplicatedStorage:WaitForChild('PlayAnimationEvent')

PlayAnimationEvent:Fire()

Also whenever you get something from ReplicatedStorage, I suggest you place it in a variable and call WaitForchild. This way, console will let you know if it didn't find what it wants, allowing you to debug easier.

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