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
 

ClickDetector - Humanoid That Clicked It

Previous Thread :: Next Thread 
fredward47 is not online. fredward47
Joined: 24 Jan 2011
Total Posts: 44
05 Jun 2013 06:21 PM
How, using scripts, could I find out who clicked a button? (I have a ClickDetector)
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
05 Jun 2013 06:22 PM
Look on the Wiki page. It gives an example.
http://wiki.roblox.com/index.php/MouseClick_(Event)

Report Abuse
fredward47 is not online. fredward47
Joined: 24 Jan 2011
Total Posts: 44
05 Jun 2013 06:50 PM
Open door script (PlayerName.Value the name of the owner of the house) :

function onClicked()
Workspace.Part.ClickDetector.MouseClick:connect(function(playerWhoClicked)
if playerWhoClicked.Name == script.Parent.Parent.Parent.Parent.Parent.Buy.PlayerName.Value then
script.Parent.Parent.Door.Transparency = 1
script.Parent.Parent.Door.CanCollide = false
end
end)

end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Buy house script:

--Button with floating text that is changeable.
--This is how to change it

--Script by Uberubert!
--Free for anyone to use

local ting = 0 --debouncer

function onTouched(hit)
if ting == 0 then --check for debounce
ting = 1
check = hit.Parent:FindFirstChild("Humanoid") --try to find the human that touched the button
if check ~= nil then --if toucher is a human then to following
script.Parent.Parent.Name = hit.Parent.Name .. " Owns this House!" --change name of button to whatever you want
script.Parent.Parent.PlayerName.Value = hit.Parent.Name
--Here you can add codes that does stuff, like moneystuff, or health or whatever you want

wait(3) --wait a while before button works again

end
ting = 0
end
end

script.Parent.Touched:connect(onTouched)



-------------


But it's not working. The door isn't opening/closing.
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