And by the way, when I tried this option and wrote a print inside the function, then just nothing came out neither when he holds the item nor when he just logs into the game
local character = script.Parent.Parent
local tool = character:WaitForChild("PUTHERETOOLNAME")
tool.Equipped:Connect(function()
--put here your code--
end)
local player = script.Parent.Parent
local character = script.Parent
local Humanoid = character:WaitForChild("Humanoid")
local tool = game.Players.LocalPlayer.Backpack:FindFirstChild("Combat") or player.Character:FindFirstChild("Combat")
tool.Equipped:Connect(function()
print("Equipped")
end)
tool.Unequipped:Connect(function()
print("Unequipped")
end)
See, it’s my script . I have the problem because in her nothing printing…
Add boolean called playerequippedtool into script and then try to use this:
local Eqquiped = script.playerequippedtool.Value
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local function ToolParent()
if Character:FindFirstChild("Combat") then
Eqquiped = true
elseif Player:WaitForChild("Backpack"):WaitForChild("Combat") then
Eqquiped = false
end
end
Player:WaitForChild("Backpack"):WaitForChild("Combat"):GetPropertyChangedSignal("Parent"):Connect(ToolParent)
end)
end)
local function Eqquipedfunc()
if Eqquiped == true then
--your code here--
end
end
script.playerequippedtool:GetPropertyChangedSignal("Value"):Connect(Eqquipedfunc)
local function Check(Tool) --Tool is name of the tool
if game.Players.LocalPlayer.Character:FindFirstChild(Tool) then
return true
else
return false
end
end