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

Position + Vector3.new isn't working ? or laggy

Asked by 7 years ago

--The Script isnt working help me :( door = script.Parent.Parent.Door function onClicked() if door.open.Value == false then door.open.Value = true door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) door.CFrame = CFrame.new(door.Position + Vector3.new(0,0.1,0)) wait(0.1) end end script.Parent.ClickDetector.MouseClick:connect (onClicked)

1 answer

Log in to vote
0
Answered by
fredfishy 833 Moderation Voter
7 years ago
Edited 7 years ago

You should be using a for loop for a job like this.


function onClicked() door = script.Parent.Parent.Door if door.open.Value == false then door.open.Value = true -- Might not be 10, but I don't want to count all those lines for i = 1, 10 do door.CFrame = CFrame.new(door.Position + Vector3.new(0, 0.1, 0)) wait(0.1) end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)

With regards to your original question, what specifically isn't working, and what error does the script provide?

0
One possible issue I could see is the case of "open". Are you sure it shouldn't be "door.Open.Value"? fredfishy 833 — 7y
0
but door isnt opening. its laggy or glitchy? FrezeTagger 75 — 7y
Ad

Answer this question