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

instance.new not working. Can anybody identify the problem?

I am creating a system which spawns blocks of ice. I have encountered a problem in which the script appears to runs through perfectly fine (no errors in the output) but does not appear to summon blocks of ice. I am not sure what to do in this situation so perhaps one of you could identify the problem?

local function newice()
	local ice = Instance.new("Part")
	local icex = math.random(5,100)
	local icey = math.random(icex/6, icex/5)
	local icez = math.random(icex/6, icex/1.3)
	local icedensity = 2.403
	local iceelasticity = 0.1
	local iceelasticityweight = 1
	local icefriction = 0.25
	local icefrictionweight = 1
	
	ice.Size = Vector3.new(icex,icey,icez)
	ice.Material = "Glass"
	ice.Transparency = 0.1
	ice.CustomPhysicalProperties = 		PhysicalProperties.new(icedensity,iceelasticity,iceelasticityweight,icefriction,icefrictionweight)
	ice.Position = Vector3.new(math.random(-249.5+icex, 249-icex), 6565, 13346)
end

while true do --for testing purposes
	newice()
	wait(2.5)
end

1 answer

✓ Accepted answer

I think you forgot to parent the ice to the Workspace service

ice.Parent = game.Workspace

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