Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Attempt to perform Arithmetic (sub) on Instance and Number?

I'm trying to make a damaging thing, where there is a script that has a value named 'damage'. It's supposed to do 4 - 2 but I always get this error

--gunfire
while true do
	local firerate = 2--in seconds
	damage = script.Parent.Damage.Value --currently 2
	local me = script.Parent
	
	wait(firerate)
	local enemy = workspace:WaitForChild("Normal")
    me:SetPrimaryPartCFrame(CFrame.new(me.PrimaryPart.Position, enemy.Position))
	script.Gunshot:Play()
	enemy.Health.Value = enemy.Healht.Value - damage
end

1 answer

i think you must take away the health of humanoid. enemy.Humanoid.Health = enemy.Humanoid.Health - damage

2 comments

0

Tracer , Doing That is not accurate for some reason on roblox because roblox's heath number can be a bit funky at some times. It is always best to Not Use Heath = Heath - Damage And To Always Use The Humanoid:TakeDamage(Damage) Method)

0

its not a humanoid

This discussion is preserved as it was. New answers, comments, and votes are closed.