zoje972
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 141 |
|
|
| 02 Jul 2012 02:42 PM |
This script should make it so you can only go through this door if you're lvl 15+. Can someone make sure I wrote it wrtie please? I'm a new scripter. All the indentions and spaces are in teh right place but they won't show up right in the post.
function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end end
Door = script.Parent function onTouched(hit) print("Door Hit") local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil ) then -- a human has touched this door! print("Human touched door") -- test the human's name against the leaderboard local player = getPlayer(human) if (player == nil) then return end local stats = player:findFirstChild("leaderstats") local sp = stats:findFirstChild("Lvl") if sp == nil then return false end if (sp.Value >= 15) then print("Human passed test") Door.Transparency = .5 Door.CanCollide = false wait(3) Door.CanCollide = true Door.Transparency = 0 else human.Health= 0 end end
end
connection = Door.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 02 Jul 2012 02:45 PM |
| I don't get why You're using GetChildren() and stuff to find the Player |
|
|
| Report Abuse |
|
|
zoje972
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 141 |
|
|
| 02 Jul 2012 02:46 PM |
| I'm not sure either, a friend just recomended it so I did it that way. |
|
|
| Report Abuse |
|
|