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

I have this error.I cant figure out? invalid argument #1 to 'new' (Vector3 expected, got Boolean)

Asked by 3 years ago

Plz help

game.ReplicatedStorage.EventBeam.OnServerEvent:Connect(function(player1)
    local Beam = game.ReplicatedStorage.PowerParts.Beam:Clone()
    Beam.Parent = game.Workspace
    local player = game.Workspace:FindFirstChild(player1.Name)
    Beam:SetPrimaryPartCFrame(CFrame.new(Beam.PrimaryPart.Position == (player.UpperTorso.Position + (player.LowerTorso.CFrame.LookVector*10))))
    game.Workspace.sounds.BeamFire:Play()
end)
0
is capitalisation and everything else correct? JesseSong 3916 — 3y
0
one thing to note: == are only useful in if statements, otherwise you'd just use = JesseSong 3916 — 3y

2 answers

Log in to vote
2
Answered by 3 years ago
Edited by JesseSong 3 years ago

In your SetPrimaryPartCFrame function, you included a ==. This is a relational operator, and it returns a boolean. Due to lack of context, I can't understand what you were trying to achieve, but this is what's causing the error. No CFrame constructor takes a boolean.

  • Boolean Operators are only sufficient in if statements, not arguments.

References:

Boolean Operators

0
Thank you so much all I had to do is use move to instead of that robot7866 36 — 3y
Ad
Log in to vote
-1
Answered by 3 years ago
 Beam:SetPrimaryPartCFrame(CFrame.new(player.UpperTorso.Position + player.LowerTorso.CFrame.LookVector*10))

Im not sure if this will work

Answer this question