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

I have a error any help please? invalid argument #1 to 'new' (Vector3 expected, got Boolean)

Sorry for the repost last time nobody responded and people usually look at the newest Questions

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)

4 comments

0

check line 5. also, check that powerparts is in replicatedstorage.

0

tell me if there's still an error

0

check that your capitalisation is correct

0

Still get it:[

2 answers

It looks like you're trying to change a value inside a CFrame, CFrames are a bunch of numbers defining the position, rotation, etc. Therefore you can't change a position inside a CFrame. I can't really see the logic behind what you're trying to set a CFrame to, therefore I can only give this explanation.

Developer article about CFrame

You used == which means its comparing

beam.PrimaryPart.Position

to

(player.UpperTorso.Position + (player.LowerTorso.CFrame.lookVector*10)

Secondly, you don't set a PrimaryPart's Position inside SetPrimaryPartCFrame(), this is what line 5 should look like, let me know if it works.

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

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