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

What wrong with this script?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
--The change script
while true do
if script.Parent.Parent.Control.Value == true then
   script.Parent.Open.Disabled = true
   script.Parent.Close.Disabled = false
end
if script.Parent.Parent.Control.Value == true then
   script.Parent.Open.Disabled = false
   script.Parent.Close.Disabled = true
end
end
--The close script
script.Parent.CanCollide = true
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(1,0,4.1)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(1,0,4.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.6)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.6)
wait(0.05)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.6)
wait(0.05)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.6)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.1)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(1,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.9,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.8,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.7,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.6,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.5,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.4,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.3,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.2,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.1,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0,0,0)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--The open script
script.Parent.Mesh.Offset = Vector3.new(0.1,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.2,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.3,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.4,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.5,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.6,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.7,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.8,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(0.9,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(1,0,0)
wait(0.01)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.6)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,0.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.6)
wait(0.05)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,1.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.6)
wait(0.05)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,2.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.2)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.3)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.4)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.5)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.6)
wait(0.05)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.7)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.8)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,3.9)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,4.0)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,4.1)
wait(0.03)
script.Parent.Mesh.Offset = Vector3.new(1,0,4.2)
wait(0.03)
script.Parent.CanCollide = false 

After l run this few scripts and l get Roblox Studio crash, Why?

1
Such ugly code. Please look into for loops. Perci1 4988 — 10y

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
10 years ago

You need wait times after the "while true do". Just do this:

--The change script
while true do
wait()
if script.Parent.Parent.Control.Value == true then
   script.Parent.Open.Disabled = true
   script.Parent.Close.Disabled = false
end
if script.Parent.Parent.Control.Value == true then
   script.Parent.Open.Disabled = false
   script.Parent.Close.Disabled = true
end
end

If the script runs without a wait time, it runs the loop infinitely and crashes the game.

0
l forget it,thanks :D 7785543 2 — 10y
Ad

Answer this question