|
| 05 Jun 2013 06:21 PM |
| How, using scripts, could I find out who clicked a button? (I have a ClickDetector) |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|