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

I made this script where when you click the window it moves. How can I fix this?

Asked by 4 years ago

Okay, I made this script where when you click the window it moves upward or downward depending on it's position, and it doesn't work. The Output said "Unable to cast instance to CoordinateFrame"

Here is the script:

01local part = script.Parent
02local detector = part:WaitForChild("ClickDetector")
03local opened = false
04local one = script.Parent.Parent:WaitForChild("LerpTo1")
05local two = script.Parent.Parent:WaitForChild("LerpTo2")
06 
07detector.MouseClick:Connect(function()
08    if opened == false then
09        for i = 0, 1, 0.5 do
10            wait(0.5)
11            part.CFrame = part.CFrame:Lerp(one, i)
12            opened = true
13        end
14    else
15        for i = 0, 1, 0.5 do
View all 21 lines...
0
Learn tweening. It moves objects to a certain position. That way you don’t have to do whiles or fors. SethHeinzman 284 — 4y
0
Also where is the function Lerp? SethHeinzman 284 — 4y
0
I put the Lerps in lines 11 and 17 aHumanWhoExists68 18 — 4y

Answer this question