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
 

A brick that gives a hint.

Previous Thread :: Next Thread 
fire5000 is not online. fire5000
Joined: 22 Sep 2009
Total Posts: 303
25 Feb 2014 10:48 AM
So, I am pretty new to scripting. How do I make the brick that when it gets touched by a robloxian, a hint appears on the screen?
Report Abuse
Ultraw is not online. Ultraw
Joined: 20 Nov 2010
Total Posts: 6575
25 Feb 2014 10:50 AM
script.Parent.Touched:connect(function(hit)
if hit.Parent ~= nil then
h = Instance.new("Hint",workspace)
h.Text = "TEXTHERE"
end
end)

Report Abuse
fire5000 is not online. fire5000
Joined: 22 Sep 2009
Total Posts: 303
25 Feb 2014 10:52 AM
If I want it to destroy after a couple of seconds, is it this?

wait (3)
message:destroy?
Report Abuse
TheGamer101 is not online. TheGamer101
Joined: 14 Feb 2009
Total Posts: 11943
25 Feb 2014 10:54 AM
wait(3)
h:Destroy()
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
25 Feb 2014 10:55 AM
Or I think you could use h:Remove()

Your number one grammar police Sheriff.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Feb 2014 11:02 AM
ur gonna need a debounce,otherwise the message will show up 1000s of times(LAG)
..heres an epic full script!:D

waiting = false

WaitTime = 5--can change

Brick = script.Parent

function onTouched(otherPart)

if otherPart.Parent:findFirstChild("Humanoid") and not waiting then
--checks if its a human,and if its not currently "waiting"

waiting = true--sets the "waiting" to true (debounce)

h = Instance.new("Hint",Workspace)--creates the hint

h.Text = "whatever u want it to say here"--the text

wait(WaitTime)--waits however long you determined in "WaitTime"

waiting = false

--allows you to touch again

end--ends the if statement
end--ends the function

Brick.Touched:connect(onTouched)--connection line
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Feb 2014 11:03 AM
oh and after
"waiting = false
--allows you to touch again"
add this:
h:destroy()--remove is deprectiated
Report Abuse
fire5000 is not online. fire5000
Joined: 22 Sep 2009
Total Posts: 303
25 Feb 2014 11:05 AM
alright, thanks.
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
25 Feb 2014 11:42 AM
Don't question TheGamer101, use :Destroy()

Make a habit of using :Destroy() instead of :Remove(), for say you had a brick with a script inside of the brick running, :Remove() will remove the brick, :Destroy() will destroy the brick and all of it's contents, and the script inside of the brick would no longer be running.
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