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

Instance tween tool will not work, why is this?

local tool = script.Parent --Defines what "tool" is
local tweenService = game:GetService("TweenService")

function onActivation()
	local newPart = Instance.new("Part")
	newPart.Position = Vector3.new(0,10,0)
	newPart.BrickColor = BrickColor.new("Bright violet")
	newPart.Size = Vector3.new(8,8,8)
	newPart.Anchored = true
	--Creates part and outlines the position, color, size, whether it's anchored, etc.
	local goal = {} --Table outlining what the end dimensons, position, etc. of the tween should be
	goal.Position = Vector3.new(10,14,34)
	goal.Size = Vector3.new(30,20,40)
	goal.Color = Color3.new(0,5,0)
	
	local tweenInfo = TweenInfo.new(8)--The speed of the tween, I think?
	
	local tween = tweenService:Create(newPart, tweenInfo, goal)--Creats the tween
	
	tween:Play()--Plays the tween
end

tool.Activated:Connect(onActivation)

This is placed inside of a localscript inside of the aforementioned tool. I was simplying rewriting this script in a more organized matter, I had previously made the script but it was messy, for some reason the part simply won't appear, and no errors appear in the output window, why is this?

2 answers

✓ Accepted answer

Hello.

Upon looking over your script I believe I've noticed a glaring issue.

Parts will not spawn without a parent!

You must add

newPart.Parent = Workspace --Or somewhere else.

for this part to spawn and do as you wish!

Though, keep in mind, with it being a local script, only the user will see it anyways.

You may want to consider that in your future updates!

I was looking through your script and realized that you don't give the part a parent.

I'd suggest plopping the line below somewhere into your code.

newPart.Parent = game.Workspace

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