Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Attempt to call a table value(what?)

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

✓ Accepted answer

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
))

1 comment

0

im coming back to scripting after like 4 months, thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.