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

Why doesnt this script work?[Solved]

Im trying to make the nuke constantly expand itself, but stop at the Vector3 Size 30,30,30 however it show me the error. Here's the script:

nuke = script.Parent
pos = nuke.CFrame
	wait(10)
	nuke.Transparency = 0.4
	nuke.CanCollide = false
while wait() do
	nuke.Size = nuke.Size + Vector3.new (0.9,0.9,0.9)
	nuke.CFrame = pos
end


if
	nuke.Size.Vector3 = (30,30,30) 
	then
	nuke:remove()
	end
end

1 answer

Well, your whole script is a mess (No offense), but there are a few points that are correct. First off, instead of constantly adding a Vector3 to the current size, and having it stop at Vector3.new(30,30,30), you could just use a for loop. Like this:

local Nuke = script.Parent
local Pos = Nuke.CFrame
wait(10)
Nuke.Transparency = 0.4
Nuke.CanCollide = false
for i = 1,30,0.9 do --1 is the start, 30 is the end, and 0.9 is the interval
	Nuke.Size = Vector3.new(i,i,i)
	Nuke.CFrame = Pos
	wait()
end
Nuke:Destroy() --Use destroy instead of remove because it causes less lag

Hope this helped!

1 comment

0

Thanks I just started scripting so I'm not the best

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