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

My script I have for my lighting system is very hard to use. Can anyone help make it better?

Asked by 5 years ago

I am currently working on a stage lighting system. I have a script that does work but I need to calculate the difference between the current position and then new position which makes it difficult. I was wondering if anyone would be able to help me make it so that I can just type in a position and then it rotates until it gets to that point.

    on = false

local tilt = script.Parent.Parent.Parent

Increment = 180



workspace.activateSpots.ClickDetector.MouseClick:Connect(function()

if on == false then

on = true

for C = 1, Increment do

wait()

tilt.PrimaryPart = tilt.hinge

tilt:SetPrimaryPartCFrame(tilt.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(21/Increment),0))

end

elseif on == true then

on = false

for C = 1, Increment do

wait()

tilt.PrimaryPart = tilt.hinge

tilt:SetPrimaryPartCFrame(tilt.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(-21/Increment),0))

end

end

end)
0
Wdym by "Type in a position"? Psudar 882 — 5y
0
I meant like so that you type 90,-45,90 and it rotates to that position. trekabytez -10 — 5y

Answer this question