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
 

Re: Click Detector Help

Previous Thread :: Next Thread 
jerryg225 is not online. jerryg225
Joined: 20 Aug 2008
Total Posts: 23187
09 Oct 2012 03:08 PM
This is supposed to do all the block in the middle when the brick is click...but it not working, help?


touch(hit)
    if (game.Players:playerFromCharacter(hit.Parent)~=nil) and not occupied then
        player=game.Players:playerFromCharacter(hit.Parent)
        theplayer=player
        player.Character:MoveTo(workspace.Conveyor1.Position+Vector3.new(0, 2, 0))
        player.Playing.Value=true
        connection=player.Character.Humanoid.Died:connect(function() die(player) end)
        occupied=true
        script.Parent.BrickColor=BrickColor.new("Bright red")
    end
script.Parent.Teleport.ClickDetector.MouseClick:connect(touch)

Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
09 Oct 2012 03:10 PM
function touch(hit)
if (game.Players:playerFromCharacter(hit.Parent)~=nil) and not occupied then -- What is occupied?
player=game.Players:playerFromCharacter(hit.Parent)
theplayer=player -- What's the point of this line?
player.Character:MoveTo(workspace.Conveyor1.Position+Vector3.new(0, 2, 0))
player.Playing.Value=true
connection=player.Character.Humanoid.Died:connect(function() die(player) end) -- what?
occupied=true -- what?
script.Parent.BrickColor=BrickColor.new("Bright red")
end
end -- missed this for the first function.
script.Parent.Teleport.ClickDetector.MouseClick:connect(touch)
Report Abuse
jerryg225 is not online. jerryg225
Joined: 20 Aug 2008
Total Posts: 23187
09 Oct 2012 03:11 PM
LOL thanks man. Oh and I know the block works, I am just editing it. I used it as a touch, but I am making it a click now...

~Lets talk when you get more money than me!
Report Abuse
jerryg225 is not online. jerryg225
Joined: 20 Aug 2008
Total Posts: 23187
09 Oct 2012 03:13 PM
Yeah, I did this earlier, and it didnt work. Still isnt. :/

~Lets talk when you get more money than me!
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
09 Oct 2012 03:14 PM
I didn't change it. I added things you need to fix. I am helping you learn.
Report Abuse
jerryg225 is not online. jerryg225
Joined: 20 Aug 2008
Total Posts: 23187
09 Oct 2012 03:14 PM
This is what it was before I am doing the update, and now the code wont work. This block down here \/ works.


function touch(hit)
    if (game.Players:playerFromCharacter(hit.Parent)~=nil) and not occupied then
        player=game.Players:playerFromCharacter(hit.Parent)
        theplayer=player
        player.Character:MoveTo(workspace.Conveyor5.Position+Vector3.new(0, 2, 0))
        player.Playing.Value=true
        connection=player.Character.Humanoid.Died:connect(function() die(player) end)
        occupied=true
        script.Parent.BrickColor=BrickColor.new("Bright red")
    end
end
script.Parent.Touched:connect(touch)
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
09 Oct 2012 03:22 PM
What is 'occupied'?
Report Abuse
jerryg225 is not online. jerryg225
Joined: 20 Aug 2008
Total Posts: 23187
09 Oct 2012 03:23 PM
It is a variable.

~Lets talk when you get more money than me!
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
09 Oct 2012 03:26 PM
It is not defined by the second line.
So, of course it will error.
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
09 Oct 2012 03:27 PM
local occupied = false
function touch(hit)
if (game.Players:playerFromCharacter(hit.Parent)~=nil) and not occupied then
player=game.Players:playerFromCharacter(hit.Parent)
theplayer=player
player.Character:MoveTo(workspace.Conveyor5.Position+Vector3.new(0, 2, 0))
player.Playing.Value=true
connection=player.Character.Humanoid.Died:connect(function() die(player) end)
occupied=true
script.Parent.BrickColor=BrickColor.new("Bright red")
end
end
script.Parent.Touched:connect(touch)
Report Abuse
jerryg225 is not online. jerryg225
Joined: 20 Aug 2008
Total Posts: 23187
09 Oct 2012 03:27 PM
I have lines previous of this....


occupied=false
oldcolor=script.Parent.BrickColor
theplayer=nil

function touch(hit)
    if (game.Players:playerFromCharacter(hit.Parent)~=nil) and not occupied then
        player=game.Players:playerFromCharacter(hit.Parent)
        theplayer=player
        player.Character:MoveTo(workspace.Conveyor5.Position+Vector3.new(0, 2, 0))
        player.Playing.Value=true
        connection=player.Character.Humanoid.Died:connect(function() die(player) end)
        occupied=true
        script.Parent.BrickColor=BrickColor.new("Bright red")
    end
end
script.Parent.Touched:connect(touch)
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
09 Oct 2012 03:31 PM
function touch(hit)
if (game.Players:playerFromCharacter(hit.Parent)~=nil) and not occupied then
occupied=true
player=game.Players:playerFromCharacter(hit.Parent)
theplayer=player
player.Character:MoveTo(Vector3.new(game.Workspace.Conveyor5.Position.x,game.Workspace.Conveyor5.Position.y + 2,game.Workspace.Conveyor5.Position.z))
player.Playing.Value=true
script.Parent.BrickColor=BrickColor.new("Bright red")
occupied = false
end
end
script.Parent.Touched:connect(touch)
Report Abuse
jerryg225 is not online. jerryg225
Joined: 20 Aug 2008
Total Posts: 23187
09 Oct 2012 03:37 PM
That doesnt work, I and I dont know why.


function touch(hit) --Can I even add a parameter here? Is that throwing it off?
if (game.Players:playerFromCharacter(hit.Parent)~=nil) and not occupied then
occupied=true
player=game.Players:playerFromCharacter(hit.Parent)
theplayer=player
player.Character:MoveTo(Vector3.new(game.Workspace.Conveyor5.Position.x,game.Workspace.Conveyor5.Position.y + 2,game.Workspace.Conveyor5.Position.z))
player.Playing.Value=true
script.Parent.BrickColor=BrickColor.new("Bright red")
occupied = false
end
end
script.Parent.Touched:connect(touch)
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
09 Oct 2012 03:38 PM
Any output?
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