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

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

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

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.

2 comments

0

Thank you but, I want to know why the top part seperates when it clones.

0

What is the whole error message? It should tell what line messed things up.

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