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

What is the problem with this script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I made a script where when you click on the door it opens, but it won't work and also I can't tell whats wrong since nothing is showing up on the output about it

Here is the script

Door = script.Parent.Main:GetChildren()
value = script.Parent.value

value.Value = 0

function onClick()
if value.Value == 1 then return end
value.Value = 1

for loop = 1,190 do

    Door.CFrame = Door.CFrame * CFrame.new(0,0,0.32) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0)
    wait(0)

end

wait(3)

for loop = 1,190 do

     Door.CFrame = Door.CFrame * CFrame.New(0,0,-0.32) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0)
    wait(0)

end

wait(.1)
value.Value = 0

end

script.Parent.ClickDetector.MouseClick:connect(onClick)

Can someone tell me what i did wrong?

2 answers

Log in to vote
0
Answered by
yoshi8080 445 Moderation Voter
9 years ago

Well I made your script a bit different when locating the door, value and clickdector. Use this if you don't want it to stop

Door = script.Parent.Main.Door
value = Door.Value

value.Value = 0

function onClick()
if value.Value == 1 then return end
value.Value = 1
for loop = 1,190 do
Door.CFrame = Door.CFrame * CFrame.new(0,0,0.32) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0)
wait()
end
for loop = 1,190 do
Door.CFrame = Door.CFrame * CFrame.new(0,0,-0.32) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0)
wait()
end
--Door.CFrame = Door.CFrame * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0)
--If you want it to act a door you can use this to stop it and click it to open it again.
wait(.1)
value.Value = 0
end
Door.ClickDetector.MouseClick:connect(onClick)

The problem is that you accidentally used New instead of new

0
At first i didn't get any error in the output but now that i changed New to new i got "18:52:28.742 - Workspace.Door.Script:12: bad argument #1 to '?' (CFrame expected, got nil)" purplemetro3421 5 — 9y
0
I made a new change and now nothing is showing up in the output again, i posted the new change below purplemetro3421 5 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

I made a change in the script, but same thing, no error is popping up in the output

I didn't change much either way

Door = workspace.Door.Main:GetChildren()
value = workspace.Door.value
Click = script.Parent

value.Value = 0

function onClick()
if value.Value == 1 then return end
value.Value = 1

for loop = 1,190 do

    Door.CFrame = Door.CFrame * CFrame.new(0,0,0.32) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0)
    wait(0)

end

wait(3)

for loop = 1,190 do

     Door.CFrame = Door.CFrame * CFrame.New(0,0,-0.32) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0)
    wait(0)

end

wait(.1)
value.Value = 0

end

Click.ClickDetector.MouseClick:connect(onClick)

Answer this question