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

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

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)

2 comments

0

is capitalisation and everything else correct?

0

one thing to note: == are only useful in if statements, otherwise you'd just use =

2 answers

✓ Accepted answer

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

1 comment

0

Thank you so much all I had to do is use move to instead of that

 Beam:SetPrimaryPartCFrame(CFrame.new(player.UpperTorso.Position + player.LowerTorso.CFrame.LookVector*10))

Im not sure if this will work

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