|
I have this script:
while true do
if script.Parent.Parent.OpenClose.Value == true then
repeat
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,-0.1,0)
wait()
until script.Parent.Position.Y >= -6
end
wait(0.01)
end
And it's supposed to stop when the Y position is less than 6, but instead of stopping it just moves faster, how do I stop this?
It's just roblox, deal with it. |
|
|
y u no break
Logicness is Logical |
|
|
What?
It's just roblox, deal with it. |
|
|
Okay so obviously this guy is a new scritper, and the first commenter is an idiot.
Second of all you put a loop in a loop, not sure if you wanted to do this but whatever.
first, use variables, second, anchor the part.
local part = script.Parent
repeat
part.CFrame = part.CFrame + Vector3.new(0,-.1,0)
wait()
until part.Position.Y >= 6
|
|
|
Dude, that's what I have, you just changed the symbol. I am not new to scripting, in fact I've been scripting for three years, but I had a brain fart. Even That doesn't work anyways :(
It's just roblox, deal with it. |
|
|
It just never stops, ever. It just moves... Forever...
It's just roblox, deal with it. |
|
|
joey you do realize you're being an ass right now to everyone,
right
|
|
|
^ I dislike people who don't give enough information and or under explain to the new scripters. It just leads to more confusion instead of understanding
|
|
|
you don't need to insult them
they are genuinely trying to help
|
|
|
Can we get to the point please? This is my script now and it doesn't stop moving...
while true do
if script.Parent.Parent.OpenClose.Value == true then
local part = script.Parent
repeat
part.CFrame = part.CFrame + Vector3.new(0,-.1,0)
wait()
until part.Position.Y >= 6
end
wait(0.01)
end
It's just roblox, deal with it. |
|
|
Because your moving it down and your checking that it's moving up
|
|
|
Okay, well I replaced the 6 with a -6 and now when it gets to -6 it will start moving FASTER.
It's just roblox, deal with it. |
|
|
i haven't worked with loops in a while but this is what i would do
if script.Parent.Parent.OpenClose.Value == true then
local part = script.Parent
while wait(.1) do
part.CFrame = part.CFrame + Vector3.new(0,-.1,0)
if part.Position.Y <=6 then
return nil
end
end
end
|
|
|
Yay! Yours worked! Thanks!
It's just roblox, deal with it. |
|
|
I think yours would have worked also if you did =6, but his was more efficient
|
|
|
"Yay! Yours worked! Thanks!"
forgot to set it to -6 but w/e
|
|
|
Okay I have another question now, how would I get it to go back UP when it's false?
while true do
if script.Parent.Parent.OpenClose.Value == true then
local part = script.Parent
while wait() do
part.CFrame = part.CFrame + Vector3.new(0,-.1,0)
if part.Position.Y <=-6.9 then
return nil
end
end
end
wait(0.01)
end
This is what I have, what would I do?
It's just roblox, deal with it. |
|
|
k best i got
MOVEDOWN.Value = true
local part = script.Parent
if script.Parent.Parent.OpenClose.Value == true then
while MOVEDOWN.Value == true do
wait()
part.CFrame = part.CFrame + Vector3.new(0,-.1,0)
if part.Position.Y <=-6.9 then
MOVEDOWN.Value = false
return nil
end
end
while MOVEDOWN.Value == false do
wait()
part.CFrame = part.CFrame + Vector3.new(0,.1,0)
if part.Position.Y >= 6 then
MOVEDOWN = true
return nil
end
end
end
|
|
|
Is there any simple way? All I want is a door to open and close when you press the button :/
It's just roblox, deal with it. |
|
|
yes
local open = false
click event
if not open then
for i = 1,6 do
door.CFrame = door.CFrame * CFrame.new(0,1,0)
end
open = true
else
for i = 1,6 do
door.CFrame = door.CFrame * CFrame.new(0,-1,0)
end
open = false
end
|
|