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

Attempt to call a table value(what?)

Asked by 4 years ago

I'm making the script so the rocket can finnaly liftoff™. But i'm running into this:

19:56:26.883 - Workspace.R1Upgrade-1.LaunchScript:23: attempt to call a table value

This is line 23 and everything related to it:

                local speed = 0
                speed = speed * 1.01
                script.Parent:SetPrimaryPartCFrame(
                    script.Parent.PrimaryPart.CFrame + Vector3(
                    script.Parent.PrimaryPart.Position.X,
                    script.Parent.PrimaryPart.Position.Y + speed,
                    script.Parent.PrimaryPart.Position.Z
                    ))

I'm really confused.

1 answer

Log in to vote
2
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Lua Objects are essential arrays with metamethods to modify the data. Vector3 is one of these Objects. You forgot to initiate the Object with it’s constructor .new(), meaning it isn’t returning any complete userdata, leaving only the array to stand. That is causing your Attempt to call a table flag.

local speed = 0
speed = speed * 1.01
script.Parent:SetPrimaryPartCFrame(
    script.Parent.PrimaryPart.CFrame + Vector3.new(
    script.Parent.PrimaryPart.Position.X,
    script.Parent.PrimaryPart.Position.Y + speed,
    script.Parent.PrimaryPart.Position.Z
))

0
im coming back to scripting after like 4 months, thanks MradmannMvip 50 — 4y
Ad

Answer this question