Okay, re-explanation. The npc hits a pad which takes away however much health it has from the "ROBLOX" value. However, it takes away 100, even if the NPC's health is not 100.
function hitdetection(hit)
if hit.Parent.Name=="Guest" then
local newvalue=game.Workspace.ROBLOX.Value-hit.Parent.Humanoid.Health
print(newvalue)
game.Workspace.ROBLOX.Value=newvalue
hit.Parent:Destroy()
end
end
local canfire=true
game.Workspace.End1.Touched:connect(function(hit)
if canfire==true then
canfire=false
hitdetection(hit)
wait (0.1)
canfire=true
end
end)

2 comments
i have the same problem
@botw_legend this is a year old post.