|
| 19 Sep 2009 06:00 AM |
heres the script. no output. it all works except it doesnt go un cancollide.
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 print("Human touched door") 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 >= 3) then print("Human passed test") Door.Transparency = .5 Door.CanCollide = false wait(3) Door.CanCollide = true Door.Transparency = .3 else human.Health= 100 end end
end
connection = Door.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Sep 2009 06:19 AM |
| has it got a humanoid in the parent? |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 06:23 AM |
yes its this:
M-Requires level 3 to pass! ------Humanoid ------Part ----------Script |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 06:23 AM |
| It works perfectly. it goes bit more transparent whn touched, it just doesnt do CanCollide = False |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 06:25 AM |
| it doens tneed a humanoid.. it findFirstChild's one in the touched player. the one I put in is for the text to apear. |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Sep 2009 06:47 AM |
| will somone repy? (oh almost 1000 posts.. epic fail == me) |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 06:52 AM |
| Stop bumping, no-one will help if there is nothing pointing towards an error. Why don;t you try to debug it, I can't see the hierarchy of your place... |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 06:54 AM |
| I tried.. everything is fine, it does EVERYTHING except let the person walk through. |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Sep 2009 06:57 AM |
| edited a free model one, I no good at leaderstats stuff. |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:00 AM |
Leaderstats are simple, it's an intvalue
You evidently don't understand the script, so go to wiki.roblox.com, learn to script and then make your own script
permission = {"Me","You"} function check(player) for _,i in pairs(permission) do if player == i then return true end end
script.Parent.Touched:connect(function(pla) if pla.Parent:findFirstChild("Humanoid")~=nil then if check(pla.Parent.Name) then --teehee end end end)
--Not sure bout that script, just made it, but it should work :D |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:02 AM |
| not a permission door.. those are easy enough, I mean checks if they have lvl 3. |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:03 AM |
| I do like the wiki, and ive read almost all of the scripting stuff on it, but I cant understand things like get player from Character... |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:05 AM |
statname = "My Stats" --change to the name of the leaderstats you want to check
script.Parent.Touched:connect(function(pla) if pla.Parent:findFirstChild("Humanoid")~=nil then if game.Players[pla.Parent.Name]:findFirstChild("leaderstats")~=nil then if game.Players[pla.Parent.Name].leaderstats:findFirstChild(statname)~=false then if game.Players[pla.Parent.Name].leaderstats[statname].Value >= 3 then --do what you want end end end end end) |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:09 AM |
Thanks, Ill give you credit, I had a basic idea of teh script in my mnd.. but it wouldent have worked.. I would have typed something like
Function Jimmy(Touch) bob = Touch.Parent.name if game.Players.bob ~= nil then bob2 = game.Players.bob bob2.findFirstChild:Leaderstats() if Leaderstats ~= nil then bob2.Leadertstats.findFirstChild:Lvl() if Lvl ~= nil then if Lvl.Value == >3 then Script.Parent.CanCollide = False
you'rs will probs work.. nad is a lot less complicated.. |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:10 AM |
oh yeah.. in my script just now i missed out
end Script.Parent:Connect(Jimmy)
(I failzorz at those things that go at the end.. I remember it for 5 mins then forget..) |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:13 AM |
Function Jimmy(Touch) bob = Touch.Parent.name if game.Players.bob ~= nil then bob2 = game.Players.bob bob2.findFirstChild:Leaderstats() if Leaderstats ~= nil then bob2.Leadertstats.findFirstChild:Lvl() if Lvl ~= nil then if Lvl.Value == >3 then Script.Parent.CanCollide = False
you'rs will probs work.. nad is a lot less complicated..
ERRORS:
Function is a nil value Jimmy() is not a function findFirstChild is not a child of bob Leaderstats is not a function Lvl is not a function False is a nil value
Also: it is >=, not ==> and script.Parent.Touched:connect() there has to be something happening, like touched or clicked. wiki.roblox.com |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:18 AM |
| mrblock, you'rs doesnt work. D: |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:19 AM |
| No, I said it probably wouldn't, what errors did you get in the output? |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:20 AM |
| checking it now.. only 1 problem.. my leaderstats dont show up in Play Solo or build... and in edit mode theres no player |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:22 AM |
| I problably didnt capitalize the S in Script.Parent |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:29 AM |
| omg.. im so stupid.. I forgot to change the statname :P |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2009 07:36 AM |
| still dont work.. ill give up on the door until i good enough to script it. |
|
|
| Report Abuse |
|
|