Vector3 expected, got Instance - [Problem]

SO I’m making a local script that fires a remote event that creates a bullet that flies in the direction of the mouse. The problem is that mouse.Hit.p is an instance and Ic don’t know why and how to fix it.

Here is the script

Localscript:

local function spellActivate() 
	
print(mouse.Hit.p)
		
if tick() - click < 0.4 then
		
	local mousehit = mouse.Hit.p
		
	Attack:FireServer(player, mousehit)
	attack:Play()
	elseif tick() - click > 0.4 then
				
end
	
	click = tick()
	
end

mouse.Button1Down:connect(spellActivate)

Serverscript:

Attack.OnServerEvent:Connect(function(player, mousehit)
	
	wait(1)
	
	local wand = player.Character:FindFirstChild("Wand")
	
		print(mousehit)
		if wand then
		print(mousehit)
		local shootP = wand.ShootPart
		local myRay = Ray.new(shootP.Position, (mousehit - shootP.Position).Unit * 500)
		local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(myRay, {player.Character, wand})
		
		local antiGravity = 0.8 -- lower numbers means lower gravity, bigger arch
		local speed = 1000 -- speed of the bullet
	

		local part = Instance.new("Part")
		part.Parent = game.Workspace
		part.CFrame = shootP.CFrame
		part.Massless = true
		part.CanCollide = false
		part.Shape = "Ball"
		part.Transparency = 1
		local efectClone = shootP.Confringo:Clone()
		efectClone.Parent = part
		efectClone.Enabled = true

		local bf = Instance.new("BodyForce")
		bf.Force = Vector3.new(0, workspace.Gravity * part:GetMass() * antiGravity, 0)
		bf.Parent = part
		local a0 = Instance.new("Attachment", part)
		a0.Position = Vector3.new(0.1, 0, 0)
		local a1 = Instance.new("Attachment", part)
		a1.Position = Vector3.new(-0.1, 0, 0)
		local trail = Instance.new("Trail", part)
		trail.Attachment0 = a0
		trail.Attachment1 = a1
		trail.FaceCamera = true
		trail.Transparency = NumberSequence.new({
			NumberSequenceKeypoint.new(0, 0),
			NumberSequenceKeypoint.new(1, 1)
		})
		trail.Lifetime = 0.1
		part.Velocity = -shootP.CFrame.upVector * speed
			
		local blocklist = {"Wand_Union", "ShootPart", "BodyAttach","LightEffect"}
		local mistake = false
		part.Touched:Connect(function(hit)
			print()
			for i, v in pairs(blocklist) do
				if v == hit.Name then
					mistake = true
					break
				end
			end
			if mistake == true then
				mistake = false
			else
				mistake = false
				--part:Destroy()
	
				
			
		
	end
end)
end
end)
2 Likes

Look at serverscript, line 8 (30)

You don’t pass the player through :FireServer.

Just do

Attack:FireServer(mousehit)

It fixed the problem but now the direction of the bullet is just off. Here is a video: