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

I need help with this script, keeps separating and error shows?

Asked by 6 years ago

My box keeps separating, I have a make joints and I have a primary part, the first clone works but when it clones, the top part separates.

This is the box script.

op1 = workspace.Box.closee.open1
op2 = workspace.Box.closee.open2
clos = workspace.Box.closee.Closed
clo = game.Workspace.Box.closee
pe = workspace.Box



clos.Transparency = 1 -- this sets the box cover to be open so that it looks normal


function kiki() -- this function will make it so that the foldes will go away when clicked
    op1.Transparency = 1
    op2.Transparency = 1
    print("working") -- for checking
        if op1.Transparency and op2.Transparency == 1 then
            clos.Transparency = 0 -- this and line 16 make sure that if both flaps are closed, the cover will be there
        end
end


clo.ClickDetector.MouseClick:connect(kiki) -- this connects the mouse clicking event to the function

function des()
wait(8)
print("destory")
pe:Destroy()

end       

This is the cloning script.

box = game.ReplicatedStorage.Box
boxPri = box.Union
dopPos = script.Parent.Donpe

while true do
    print 'NOW DROPPING'
    wait(7)
    box:Clone().Parent = workspace
    box:MakeJoints()
    box.Union.CFrame = dopPos.CFrame
end

error

16:55:38.696 - open1 is not a valid member of Model

1 answer

Log in to vote
0
Answered by 6 years ago

From what I see, you got a variable wrong. Check your paths again please. Because the model you have apparently doesn't have an object called "open1" in it. Or maybe if you are ABSOLUTELY sure it exists and you got your naming and paths right, add a WaitForChild()

Also, line 16 is you wanna check if op1 is transparent should be:

if op1.Transparency == 1 and op2.Transparency == 1 then

Because they way you are doing it now is just checking if "op1" exists and is not nil.

0
Thank you but, I want to know why the top part seperates when it clones. TheLightningRises 56 — 6y
0
What is the whole error message? It should tell what line messed things up. DatOneRandomDude 69 — 6y
Ad

Answer this question