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

Whats wrong with this Rotation script?

Asked by 9 years ago

Could anyone help me fix my Rotation script? Or at least tell the what is wrong with it.

lever = script.Parent

lever.Touched:connect(function(hit)
while true do
    lever.Rotation = Vector3.new(-17.373, 0.59, 8.72) + 2
end
end)

lever.Touched:connect()
0
Which coordinate(s) do you want to add the number 2 to? gskw 1046 — 9y
0
17 KennyAtkins 0 — 9y

1 answer

Log in to vote
1
Answered by
gskw 1046 Moderation Voter
9 years ago

I suppose you want to add the 2 to the first coordinate (x). Use this:

lever = script.Parent
lever.Touched:connect(function(hit)
    while true do
        lever.Rotation = Vector3.new(-17-373, 0.59, 8.72) + Vector3.new(2, 0, 0)
    end
end)

You can't tell the script to add 2 to the Vector3 as it doesn't know which coordinate it should add to.

1
There are a few additional problems with this. Unless a wait() is added, that while loop will crash the server. Also, this rotation is set to a fixed rotation, and never changes past that. You have to do level.Rotation = lever.Rotation + Vector3.new(2) --(valid btw) to fix that. Finally, that loop will never exit. adark 5487 — 9y
Ad

Answer this question