So I have a script that is in the tool in the starter pack, it is a LOCAL SCRIPT. Here is the code of the script… The problem is that I can’t find a humanoid. Just in the output, nothing is written.
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or script.Parent.Parent.Parent
local humanoid = character:WaitForChild("Humanoid")
local tool = --local the tool
tool.Equipped:Connect(function()
local Humanoid = script.Parent.Parent.Parent:FindFirstChild("Humanoid") --If the script is inside the handle this should work.
if Humanoid then
print("Humanoid exists!")
else
print("Nothing...")
end
end)
local rp = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or script.Parent.Parent.Parent
local humanoid = character:WaitForChild("Humanoid")
print(humanoid)
local tool = script.Parent
local equipped = false
local event = rp:WaitForChild("Combat")
local Animations = rp:WaitForChild("Animations")
tool.RequiresHandle = false
script.Parent.Equipped:Connect(function()
equipped = true
print(equipped)
end)
script.Parent.Unequipped:Connect(function()
equipped = false
print(equipped)
end)
so for the local character, I personally tend to use
local character = player.Character or player.CharacterAdded:Wait()
so sometimes if the game could not detect the player.Character due to loading proccess, it can wait until the character is loaded and find it, and maybe get rid of the script.parent.parent.parent thingy