How to get a sword to do Self-Infliction and then Loop?
So I want my sword to be special and if you like don't have permission to not get harmed by the sword you get hurt for holding it...
But I don't think the script I've made is right...
But this is all I could think of.
I don't know how to loop either, so could someone help with that?
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 where do I put the script in the sword...
THX!