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

the TweenService in my script wont work?

script.Parent:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player)
	local terrainPart = game:GetService("ReplicatedStorage"):WaitForChild("TerrainPart"):Clone()
	local tween = game:GetService("TweenService")
	terrainPart.Position = player.Character.HumanoidRootPart.Position+Vector3.new(math.random(0,20),0,math.random(0,30))-Vector3.new(0,10,0)
	terrainPart.CanCollide = false
	terrainPart.Anchored = true
	terrainPart.Parent = game.Workspace
	tween:Create(terrainPart,TweenInfo.new(5),{Position = Vector3.new(0,10,0) + terrainPart.Position})
end)

Im trying to make a part emerge from the ground after it being cloned, but the part isnt moving at all. Anyone can figure out why?

1 answer

✓ Accepted answer

You forgot to play the tween

script.Parent:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player)
    local terrainPart = game:GetService("ReplicatedStorage"):WaitForChild("TerrainPart"):Clone()
    local tween = game:GetService("TweenService")
    terrainPart.Position = player.Character.HumanoidRootPart.Position+Vector3.new(math.random(0,20),0,math.random(0,30))-Vector3.new(0,10,0)
    terrainPart.CanCollide = false
    terrainPart.Anchored = true
    terrainPart.Parent = game.Workspace
    local playtween = tween:Create(terrainPart,TweenInfo.new(5),{Position = Vector3.new(0,10,0) + terrainPart.Position})
   playtween:Play()
end)

3 comments

0

Oh mb lol.

0

Its alright

0

Oh and by the way how would I repeat this function again and again? do I use repeat until or is there another way?

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