So I got a few NPCs in my game which have projectiles. The last one that I fought with had .Touched, not sure if that’s the problem but it’d be nice if someone knows what the problem is.
I keep dying after spawning which is super weird. I did some debugging and it printed the health which instantly jumped from 25k to 100 for some weird reason. I looked on Developer Hub but couldn’t find a solution to this problem.
func = part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
local hum = hit.Parent.Humanoid
if hum.Parent:FindFirstChild('Info') then return end
if not cooldowns.Player[hum] or os.clock() - cooldowns.Player[hum] > .05 then
cooldowns.Player[hum] = os.clock()
print(hum.Health)
hum:TakeDamage(100)
end
end
end)
Looks like i think i found a problem. So basically if you touch a npc that are near you (which you will mostly likely die without even touching since they are so close to you) because according to the script. It takes your full health when you touch so it might be problem and try move npc or fix the script by replacing touched. If you dont know what to fix the script then you might need to search it up on roblox youtube tutorial. Hope it helped.