Hello,
yes ive looked for other peoples solutions and everything.
Ive searched multiple topics and various forums.
None of them worked and went to my almost last resort: AI
Also didnt work as excpected. My last resort: Making a topic
Whats my probem? Basically what the title says.
I have multiple modules, one of them clones the tool, parents it into a folder in serverstorage which works, and then throws it in the backpack of the player, i also tried putting it in the char of the plr with no succes.
A short video of 7 sec demonstrating the output and the outcome of the issue:
https://gyazo.com/529541c3edc83da200f81f96f6c0b4ca
The snippet of code which clones and throws it in the serverstorage:
function Handler.new(tool:Tool, hrp:Part)
local model = Instance.new("Model")
local char:Model = hrp.Parent
local arm:Part = char:FindFirstChild("Right Arm")
local self = setmetatable({}, Handler)
self.max = tool:GetAttribute("Max")
local clone = tool:Clone()
clone.Parent = throwntools
self.t = clone
Yes im 100% sure the tool exists and the hrp exists.
The serverscript which fires the Handler.new()
local remote = game.ReplicatedStorage.Remotes.ExtraMechanics.meleeThrow
local toolHandler = require(script.ToolHandler)
remote.OnServerEvent:Connect(function(plr, tool, dir)
local char = plr.Character
local hrp:Part = char.HumanoidRootPart
if tool and dir and tool:GetAttribute("Melee") then
local new = toolHandler.new(tool, hrp)
new:Throw(dir, char)
end
end)
When picking it up, this is when its putted in the backpack of the player using an proximity prompt:
function handler:PickUp()
local prox:ProximityPrompt = self.p
local tool:Tool = self.t
local m:Model = self.m
prox.Triggered:Connect(function(plr)
local backpack = plr.Backpack
tool.Parent = backpack
m:Destroy()
end)
end
I would appreciate concise explanation of whats happening and why its throwing errors. Error: 14:52:07.491 Players.emiliotigre2017.Backpack.IcePick.Server:19: attempt to index nil with 'OnHit' - Server - Server:19
What onHit? Well a function if a module im using called raycasthitbox V4
I am willing to share the script of the tool if asked.
Thanks for reading