local

function BIGBlaster()
	if activu == true then return end
	if bigblastercooldown == true then return end
	activu = true
	bigblastercooldown = true
	punchsfx:Play()
	local mousehit = mouse.Hit.p
	bigblastevent:FireServer(mousehit)
	wait(0.4)
	activu = false
	wait(25)
	local bigblastercooldown = false
end

(mouse is defined further up in the script)

server

game:GetService("ReplicatedStorage").DTWAUBlast.OnServerEvent:Connect(function(player, mousehit)
	local chr = player.Character
	local rarm = chr["Right Arm"]
		local hed = chr["Head"]


	local blaster = game.ServerStorage.DTWAUActualBlast
	local gblaster = blaster:Clone()
	gblaster.Parent = workspace.Effects
	
		gblaster.CFrame = CFrame.new(chr.HumanoidRootPart.Position, mousehit) * CFrame.Angles(math.pi/2, 0, 0)
	

its meant to be a gun that shows up behind you and aims towards the mouse.

it keeps giving me Invalid argument #2 (Vector3 expected, got nil), what exactly am i missing or doing wrong here?

7 comments

0

Which line does the error come from?

0

You should never use wait(n) or wait() it can be really bad for your game's performance.

0

what is mousehit?

0

comes from line 11 in server, mousehit is mouse.Hit.p

0

why do you have 2 vector3's inside of the CFrame? CFrame takes in 3 axis which are x, y and z. which makes it a vector3

0

So what do i do with mousepos then?

0

Hi, I believe the problem for you here is: You need to define a 3rd value. Vector3 = (X,Y,Z) Your X was defined as chr.HumanoidRootPart.Position Your Y was defined as mousehit Your Z must be defined. Other than this, I don't know how else to help you.