How to make a script to inflict harm on the wielder?
So basically, I have this sword which is 'over-corrupt' meaning it's so corrupt it hurts the person who is handling it...
I want it to hurt the player like slowly but not so slow they regenerate health or anything, just so they'll notice after around 5 seconds they're somehow getting hurt, and in this case poisoned.
I'm not sure why this won't work but can someone explain and fix it?
Oh and would I need a bit to also make sure they don't regenerate health? Because I thought you can only regenerate health after a certain time of no damage, unless you have a gear - like the regeneration coil.
02 | permission = { "MasterPoke99" } |
06 | function checkOkToLetIn(name) |
07 | for i = 1 ,#permission do |
10 | if (string.upper(name) = = string.upper(permission [ i ] )) then return true end |
15 | local Door = script.Parent |
17 | function onTouched(hit) |
19 | local human = hit.Parent:findFirstChild( "Humanoid" ) |
20 | if (human ~ = nil ) then |
21 | if human.Parent.Torso.roblox.Texture = = texture then |
23 | Door.CanCollide = true |
25 | Door.CanCollide = true |
28 | print ( "Human touched Poison Blade" ) |
30 | elseif (checkOkToLetIn(human.Parent.Name)) then |
31 | print ( "Human passed test" ) |
33 | Door.CanCollide = true |
35 | Door.CanCollide = true |
37 | else game.Workspace.Player [ "Left Arm" ] .Anchored = true |
38 | game.Workspace.Player [ "Right Arm" ] .Anchored = true |
39 | game.Workspace.Player [ "Left Leg" ] .Anchored = true |
40 | game.Workspace.Player [ "Right Leg" ] .Anchored = true |
41 | game.Workspace.Player.Head.Anchored = true |
42 | game.Workspace.Player.Torso.Anchored = true |
44 | game.Workspace.Player.Health:Remove() |
45 | game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health - 0.1 |
47 | game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health - 0.1 |
49 | game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health - 0.1 |
51 | game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health - 0.1 |
Oh and I forgot to mention, I only want some people to be 'immune' to it's 'over-corruption'
So the script kinda also sums up what I want for it to do... Oh and where should I put it - Because at the moment it's in the handle.
Thanks... Oh and maybe change the long list into a loop? -- I don't know how :3