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 » Scripters
Home Search
 

Re: A door that opens only if you have 0 points?

Previous Thread :: Next Thread 
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 09:58 AM
I tried it, i cant seem to get it to work and i am very confused...

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("Points")
if sp == nil then return false end
if (sp.Value <= 1) then

Door.CanCollide = true

else
Door.Cancollide = false

end
end

end

connection = Door.Touched:connect(onTouched)



( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
Proxemics is not online. Proxemics
Joined: 30 Oct 2013
Total Posts: 2542
26 Apr 2015 10:03 AM
local player = game.Players.LocalPlayer
local door = game.Workspace.Door --name of the door
door.CanCollide = true
if player:FindFirstChild("leaderstats") then
if player.leaderstats:FindFirstChild("Points") then
if player.leaderstats.Points.Value <= 0 then
if door.CanCollide = true then
door.CanCollide = false
else
return false
end
end
end
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:20 AM
that didn't work


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:25 AM
bump


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:26 AM
bump


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:26 AM
bump


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:27 AM
bump


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
26 Apr 2015 10:27 AM
use getplrfromchar

God grant me the wisdom to not punch stupid ppl, for I know I will go to prison.
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:28 AM
bump


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:32 AM
bump


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
26 Apr 2015 10:33 AM
stop bumping i told you how

God grant me the wisdom to not punch stupid ppl, for I know I will go to prison.
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 10:38 AM
please give me a whole script, i dont know about what you told me and how i can make it work...


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
26 Apr 2015 10:40 AM
script.Parent.Touched:connect(function(hit)
local p = game.Players:GetPlayerFromCharacter(hit.Parent)
if p.leaderstats.Points.Value == 0 then
-- do stuff
end
end)

God grant me the wisdom to not punch stupid ppl, for I know I will go to prison.
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 11:23 AM
@thenewchicken
take a look...
it isnt working btw
http://www.roblox.com/help-item?id=242506178

i put in this:
script.Parent.Touched:connect(function(hit)
local p = game.Players:GetPlayerFromCharacter(hit.Parent)
if p.leaderstats.Points.Value == 0 then
print("Human passed test")
Door.Transparency = 1
Door.CanCollide = false
wait(3)
Door.CanCollide = true
else
h.Text("You already completed the level!")
wait(5)
h.Text=false


end



end
There are no errors and it is not working!!!


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
26 Apr 2015 11:29 AM
script.Parent.Touched:connect(function(hit)
local Door = script.Parent
local p = game.Players:GetPlayerFromCharacter(hit.Parent)
if p.leaderstats.Points.Value == 0 then
print("Human passed test")
Door.Transparency = 0.5
Door.CanCollide = false
wait(3)
Door.CanCollide = true
Door.Transparency = 0
else
Instance.new('Hint',p.PlayerGui).Text = 'YourTextHere'
wait(3)
p.PlayerGui.Hint:Destroy()
end
end)

God grant me the wisdom to not punch stupid ppl, for I know I will go to prison.
Report Abuse
Duckywow is not online. Duckywow
Joined: 24 Oct 2013
Total Posts: 6110
26 Apr 2015 11:51 AM
@thenewchicken
thanks, it worked


( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一 Insert stupid siggy here ( ͠° ͟ʖ ͡°)-▄︻̷̿┻̿═━一
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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