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

CFrame Expected, got number? Help?

Asked by 6 years ago
local MainCFrame1 = script.Parent:GetPrimaryPartCFrame()

while game:GetService("RunService").Heartbeat:wait() do
    local sin, rad = math.sin, math.rad
    local t = tick()

local newCFrame1 = MainCFrame1 * CFrame.new(sin(t*1.8)*.5, (sin(t*1.6)*.5), (sin(t*2)*.5) * CFrame.Angles(rad(sin(t*3) * 2), rad(sin(t*3.2) * 4), rad(sin(t*3) * 6)))
    script.Parent:SetPrimaryPartCFrame(newCFrame1)

end

Output says

 bad argument #1 to '?' (CFrame expected, got number)

Any ideas on how to fix this?

1 answer

Log in to vote
0
Answered by
ax_gold 360 Moderation Voter
6 years ago
Edited 6 years ago

Your parenthesis are messed up, there should be another parenthesis at the end of the first CFrame. I fixed it and tested it for you. Here you go.

local MainCFrame1 = script.Parent:GetPrimaryPartCFrame()

while game:GetService("RunService").Heartbeat:wait() do
    local sin, rad = math.sin, math.rad
    local t = tick()

local newCFrame1 = MainCFrame1 * CFrame.new(sin(t*1.8)*.5, (sin(t*1.6)*.5), (sin(t*2)*.5)) * CFrame.Angles(rad(sin(t*3) * 2), rad(sin(t*3.2) * 4), rad(sin(t*3) * 6))
    script.Parent:SetPrimaryPartCFrame(newCFrame1)

end

let me know if there are any issues.

Ad

Answer this question