I have a module script that I use for skills and right now I have a skill which shoots off an attack which is located at your mouse position, with a function in the tool and a script which identifies the function even though I dont know its needed it comes out with the error :
Argument 1 Missing Or Nil
This is the tool’s children :
The mouse script :
local Tool = script.Parent
local MouseLoc = Tool:WaitForChild("MouseLoc")
function MouseLoc.OnClientInvoke()
return game:GetService("Players").LocalPlayer:GetMouse().Hit.
end
The module script :
function module.RealSlash(player)
for i,v in pairs(game.Players:GetChildren()) do
local char = v.Character or v.CharacterAdded:Wait()
if char:FindFirstChild("Real Knife") then
local tool = char:FindFirstChild("Real Knife")
v.leaderstats.PlayerValues.TP.Value = v.leaderstats.PlayerValues.TP.Value - 25
local debounce = false
local MouseLoc = tool:WaitForChild("MouseLoc")
local character = script.Parent.Parent
local targetPos = MouseLoc:InvokeClient(game:GetService("Players"):GetPlayerFromCharacter(character))
local lookAt = (targetPos - character.Head.Position).unit
local star = game.ServerStorage.StarShot:Clone()
local dmg = game.ServerStorage.StarDamage:Clone()
local destroy = game.ServerStorage.StarDestroy:Clone()
if not debounce then
debounce = true
star.Material = "Neon"
star.Anchored = false
star.CanCollide = false
local spawnPos = script.Parent.Handle.Position
spawnPos = spawnPos + (lookAt * 5)
star.Name = "SoulSwordStar"
local antiGravity = Instance.new("BodyForce")
antiGravity.Force = Vector3.new(0, workspace.Gravity * star:GetMass(), 0)
antiGravity.Parent = star
star.Velocity = lookAt * 100
destroy.Parent = star
dmg.Parent = star
star.Color = script.Parent.BladeValue.Value
star.Parent = workspace
star:SetNetworkOwner((game:GetService("Players"):GetPlayerFromCharacter(character)))
game:GetService("Debris"):AddItem(star, 10)
star.Position = script.Parent.Parent.HumanoidRootPart.Position
wait(0.75)
debounce = false
end
else
continue
end
end
end
return module
Help would be greatly appreciated thank you! : D