You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
I have an error in the output in which I want to fix -
What is the issue? Include screenshots / videos if possible!
When calling the mousePosition variable in the mouseRaycast function as when it tries to run, it returns an attempt to call a Vector3 value error in the output -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried removing the player variable but that results in another error which says Argument 1 missing or nil
Server Script
local function mouseRaycast(player, origin)
local mousePosition = GetHitpoint:InvokeClient(player)
print(player)
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {player.Character}
local raycastResult = workspace:Raycast(origin, (mousePosition - origin) * 300, raycastParams)
return raycastResult
end
local attackFunctions = {
["Firearm"] = function(player, weapon, config)
local ammo = 8
local maxAmmo = 8
local raycastResult = mouseRaycast(player, weapon.Handle)
if raycastResult then
-- some extra code
end
end,
}
Client Script
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local function mouse()
local mouse = player:GetMouse()
return mouse.Hit.Position
end
GetHitpoint.OnClientInvoke = mouse()