Help with Error: 'MaxForce cannot be assigned to '

So in my game you should be able to throw firework but everytime I try to set the MaxVelocity of the LinearVelocity the error comes.

The Code:

local FireworkIndex = {
    ["BundleOfFirework"] = {
        FullName = "Bundle Of Firework",
        Model = GameAssets.Firework.BundleOfFirework,
        MaxVel = 10000,
        Vel = 5000
    }
}

-- Throw code:

FireFirework:Connect(function(Player: Player, LookVector: Vector3)
    local Char = Player.Character

    if Char then
        local Root = Char:FindFirstChild("HumanoidRootPart")

        if Root then
           local Firework = FireworkIndex["BundleOfFirework"]
           local Model = Firework.Model:Clone()

           Model.PrimaryPart.CFrame = Root.CFrame + Root.CFrame.LookVector -- Ignore this
           Model.PrimaryPart.CFrame = CFrame.lookAt(Model.PrimaryPart.Position, LookVector) -- and this please
           
           Model.Parent = workspace

           Model.PrimaryPart.Velocity.MaxForce = Firework.MaxVel -- Error comes from here
           Model.PrimaryPart.Velocity.VectorVelocity = Root.CFrame.LookVector * Firework.Vel
        end
    end
end)

Try printing out the velocity and tell me what you got

Prints 10000

This text will be blurred

Did you print the MaxVel or MaxForce? If you did I mean’t that you should print MaxForce.

I printed the MaxVel
Kinda wierd error

Can’t understand the problem. How about try commenting the erroring line, and check if the next line errors as well or it works.

The next line errors the exact same error but for the VectorVelocity

Weird. Maybe try removing the Firework variable and just define the table? (Though I don’t think it’ll change anything)

Yep. It didn’t change anything

Are you using a LinearVelocity or something else? Also, correct me if I’m wrong but I’m pretty sure that the VectorVelocity property is a Vector3 type.

I’m using a LinearVelocity and

the LookVector is a Vector3

what does the error say on the output?

Oh right. I’m not sure what could be the problem. For now, maybe try putting them in a pcall and warning out the result?

(Though I think it’d just warn the error instead)

I just tried changing the max force through the command bar and it worked, so I literally have no idea what could be causing the problem. Probably another Roblox thing.

VectorVelocity cannot be assigned to

I found the problem

I probably shouldn’t have named Velocity becouse of the depricated Velocity :sweat_smile:

Thanks anyways

Oh alright. Good thing you found the problem! Good luck on developing!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.