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

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

Asked by 3 years ago
Edited by JesseSong 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
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)

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

right on line 5 (beam.PrimaryPart.Position == (player.UpperTorso.Position ==

signs are used to compare 2 different values, not to use values im taking it you wanted to add on the position? in that case its a simple fix

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)

you also dont need all of the brackets you put in as youre only doing addition and multiplication at the end

Ad

Answer this question