Learning Tweens - materials issue

This code seems to work just fine until I change the material from plastic to wood/woodplanks and then it seems to bug out (idk any other word for it). I figured I would use a tween to drop parts so a wall could appear to be made.

For now it’s just a mass of parts in a model as I’m just learning how to tween.

Have I overlooked something?

local repStore = game:GetService("ReplicatedStorage")
local prompt = script.Parent
prompt.Enabled = true
local hammerSound = repStore:WaitForChild("HammerSound")
hammerSound.SoundId = "rbxassetid://180163743"
local bunchOfParts = game.Workspace.BunchOfParts
local tweenService = game:GetService("TweenService")

local function showParts()
	for _, item in pairs(bunchOfParts:GetChildren())do
		if item:IsA("Part")then
			
			prompt.Enabled = false
			
			local clone = item:Clone()
			clone.Position = item.Position + Vector3.new(0,3,0)
			clone.Transparency = 0
			clone.Parent = item.Parent
			
			-- set up tween
			local tweenInfo = TweenInfo.new(
				1,
				Enum.EasingStyle.Bounce,
				Enum.EasingDirection.Out
			)
			local endPosition = item.Position
			
			local tween = tweenService:Create(clone, tweenInfo, {Position = endPosition})--create tween(instance, info, position)
			
			tween:Play()
			--plays hammering sounds
			for i = 1, 3 do
				hammerSound:Play()
				hammerSound.Ended:Wait()
			end
			
			tween.Completed:Wait()
			
			item.Transparency = 0
			item.CanCollide = true
			clone:Destroy()
			task.wait()
		end
	end
	
end

prompt.Triggered:Connect(showParts)

Could you show a video? I’m confused about why changing material would make the tweens “bug out”.

Sorry forget I mentioned anything. The problem seemed to fixed itself. I spent hours last night with a glitch and didn’t know why and now it’s working just fine.

1 Like

Good set up, but get this one too …
local bunchOfParts = workspace:WaitForChild(“BunchOfParts”)

It not only has to work, it needs to be pretty … :rofl:

local tweenService = game:GetService("TweenService")
local repStore = game:GetService("ReplicatedStorage")
local hammerSound = repStore:WaitForChild("HammerSound")
local bunchOfParts = workspace:WaitForChild("BunchOfParts")
hammerSound.SoundId = "rbxassetid://180163743"
local prompt = script.Parent
prompt.Enabled = true

Yeah I do all that once it’s all working properly but thx for the heads up.

1 Like