Hey there,
I am currently writing a script and are in need of assistance. They script should slowly start to kill the player.
The Script:
repeat
character.Health = character.Health - 10
wait(5)
until
character.Health == 0
(That is only part of the script, it is also the only part I am having trouble with)
Every time I run the game I get this error in the output
Workspace.pinchpotmonster.E-005Effects:9: attempt to perform arithmetic (sub) on Instance and number
The script is located inside of StarterCharacterScripts.
Thank you for the assistance. 
3 Likes
Could we see the full script? Maybe you defined something wrong 
2 Likes
Yeah sure,
local character = script.Parent
local E005 = game.Workspace.EntityZones.WhiteClassSector.WhiteClassEntities["E-005"]
game.Workspace.EntityZones.WhiteClassSector.WhiteClassEntities["E-005"].ProximityPrompt.Triggered:Connect(function()
E005["E-005"].Position = character.Head.Position
game.Workspace.EntityZones.WhiteClassSector.WhiteClassEntities["E-005"].ProximityPrompt.MaxActivationDistance = 0
repeat
character.Health = character.Health - 10
wait(5)
until
character.Health == 0
-- Welding the Entity to the player
local weld = Instance.new("ManualWeld")
local P0 = E005.PrimaryPart
local P1 = character.Head
weld.Part0 = P0
weld.Part1 = P1
weld.Parent = E005.PrimaryPart
if character.Health == 0 and E005["E-005"].Position == character.Head.Position then
E005["E-005"].Position = Vector3.new(-131.236, -122.347, -389.214)
end
end)
2 Likes
try this
repeat
character.Humanoid.Health = character.Humanoid.Health - 10
wait(5)
until
character.Humanoid.Health == 0
6 Likes
Ah I see the issue
You only defined character
as a Instance value, but not the actual Humanoid
of the character that has that Health
property which is resulting in that error
Just change your repeat loop to this:
repeat
character.Humanoid.Health = character.Humanoid.Health - 10
wait(5)
until
character.Humanoid.Health == 0
3 Likes
Thank you, I accidentally forgot to add .Humanoid
1 Like