Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

in my script why does the part created by it disappear after the script tries to create a new one?

Asked by 4 years ago
local Part = Instance.new("Part")
while true do
    wait(1)
    Instance.new("Part")
    Part.Size = Vector3.new(10, 10, 1)
    Part.CFrame = CFrame.new(50, 50, 50)
    Part.Parent = workspace
    Part.Name = "brick probaluy"
    print("part created")
    wait(1)
end

does anyone know what i have done wrong?

0
There is a variable called Part, on line 4 I think you mistaked cloning the variable and instead cloned the base object. Try local Part = Instance.new("Part") on line 4, replace the whole thing greatneil80 2647 — 4y

1 answer

Log in to vote
0
Answered by
rstkdev 15
4 years ago
Edited 4 years ago

on the top of your script, you create the "Part" variable containing a Part Instance then in your while loop you are changing the "Part" properties, not the new part properties (the one created in your while loop)

you have to do :

local Part = Instance.new("Part")

while true do
    wait(1)
    local newPart = Instance.new("Part")
    newPart.Size = Vector3.new(10,10,1)
    newPart.CFrame = CFrame.new(50,50,50)
    newPart.Name = "the name you want"
    newPart.Parent = workspace
    print("part created")
end
0
thanks for the help! it now works. defaultkid99 4 — 4y
Ad

Answer this question