Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a script to inflict harm on the wielder?

Asked by 10 years ago

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.


-- list of account names allowed to go through the door. permission = { "MasterPoke99" } -- This is how many people can still get through, so u don't have to change shirts. You can also have another friend here. -EDIT -- TextureId of the VIP shirt. texture = "http://www.roblox.com" -- EDIT function checkOkToLetIn(name) for i = 1,#permission do -- convert strings to all upper case, otherwise we will let in -- "Username" but not "username" or "uSERNAME" if (string.upper(name) == string.upper(permission[i])) then return true end end return false end local Door = script.Parent function onTouched(hit) print("Door Hit") local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil ) then if human.Parent.Torso.roblox.Texture == texture then --the shirt Door.Transparency = 0 Door.CanCollide = true wait(.1) -- this is how long the door is open Door.CanCollide = true Door.Transparency = 0 -- a human has touched this door! print("Human touched Poison Blade") -- test the human's name against the permission list elseif (checkOkToLetIn(human.Parent.Name)) then print("Human passed test") Door.Transparency = 0 Door.CanCollide = true wait(.1) -- this is how long the door is open Door.CanCollide = true Door.Transparency = 0 else game.Workspace.Player["Left Arm"].Anchored = true game.Workspace.Player["Right Arm"].Anchored = true game.Workspace.Player["Left Leg"].Anchored = true game.Workspace.Player["Right Leg"].Anchored = true game.Workspace.Player.Head.Anchored = true game.Workspace.Player.Torso.Anchored = true wait(1) game.Workspace.Player.Health:Remove() game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health -0.1 wait(1) game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health -0.1 wait(1) game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health -0.1 wait(1) game.Workspace.Player.Humanoid.Health = game.Workspace.Player.Humanoid.Health -0.1 -- This goes on for along time until the wielder dies...

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

Answer this question