Alright I made a MedKit. Strange thing is, it works when I test it in ROBLOX Studio, but when I play the actual game, the medkit does not work. It is composed of a Tool named Medical Kit, a Union inside named Handle, and a Script named MedKitScript. It is a normal script.
local tool = script.Parent local healValue = 50 local canHeal = true tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() local humanoid = tool.Parent.Humanoid if humanoid and canHeal then canHeal = false local currentHealth = humanoid.Health local newHealth = currentHealth + healValue humanoid.Health = newHealth wait(2) tool:Destroy() end end) end)
The mouse can only be accessed from the client I think. My guess to solving this problem is instead using tool.Activated, in which it fires every time the players activates the tool:
local tool = script.Parent local healValue = 50 local canHeal = true tool.Activated:connect(function() local humanoid = tool.Parent.Humanoid if humanoid and canHeal then canHeal = false local currentHealth = humanoid.Health local newHealth = currentHealth + healValue humanoid.Health = newHealth wait(2) tool:Destroy() end end)