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
 

Click function

Previous Thread :: Next Thread 
korrykorry is not online. korrykorry
Joined: 23 Jul 2013
Total Posts: 182
15 Aug 2013 01:57 PM
a script to make a part not-CanCollide:

started with:
function onClicked(MouseClick) --but i think this is wrong, can someone correct this please :P im just a beginner in scripting
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
15 Aug 2013 02:06 PM
function onClicked(player)

end

part.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
15 Aug 2013 02:16 PM
-- With a HopperBin...
function onSelected(mouse) -- Our function, we have to create the mouse.
script.Parent.mouse.Button1Down:connect(function() -- when you left button click... connect this
a = mouse.Target -- What the mouse is pointing to
if a.ClassName == "Part" or a.ClassName == "CornerWedge"
or a.ClassName == "Wedge" then -- If the target is actually an object then
a.Transparency = 1 -- Turn in invisable
end -- Don't get these confused
end)
end
script.Parent.Selected:connect(onSelected) -- Connect the function we made, onSelect

______________________Different Script______________________

--With a ClickDetector
-- Insert this into a brick.
if not script.Parent:FindFirstChild("ClickDetector") then -- If there is no Click Detector then
Instance.new("ClickDetector", script.Parent) -- Make a new one in the script's parent.
end

function onClicked(GuyWhoClickedMouseWhichIsInimportant)
script.Parent.Transparency = 1 --When it is clicked, make the parent invisible.
end

script.Parent.ClickDetector.MouseClick:connect(onClick) --[[ When the click detector inside the parent gets clicked on, it will do the "onClicked" function we created]]

-- Try to learn from it.
Report Abuse
Yiha26 is not online. Yiha26
Joined: 16 Jul 2012
Total Posts: 6117
15 Aug 2013 03:00 PM
wait this is the full script:

function onClicked(Button1)

script.Parent.Parent.Floor1.CanCollide = false
wait(2)
script.Parent.Parent.Floor1.CanCollide = true

script.Parent.Click:connect(onClicked)
end

(note: Click = the clickdetector)
Report Abuse
Yiha26 is not online. Yiha26
Joined: 16 Jul 2012
Total Posts: 6117
15 Aug 2013 03:01 PM
[korrykorry is me]
xD
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