generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Proofread this please?

Previous Thread :: Next Thread 
zoje972 is not online. 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
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
02 Jul 2012 02:45 PM
I don't get why You're using GetChildren() and stuff to find the Player
Report Abuse
zoje972 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image