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: Why isn't the message not being removed?

Previous Thread :: Next Thread 
LordGan is not online. LordGan
Joined: 23 Dec 2010
Total Posts: 1366
04 Jul 2014 06:57 PM
sp = script.Parent

function onTouched(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
m = Instance.new("Hint",Workspace)
m.Text = "Your gift is down the hall son :)"
wait(5)
m:remove()
end
end

sp.Touched:connect(onTouched)



This script is inside a brick called "P1"
Report Abuse
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
04 Jul 2014 07:01 PM
The problem is that too many Message objects are being created when a character touches the part. To fix this, I added in a debounce into the script.

sp = script.Parent
enabled = true

function onTouched(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if (h ~= nil) and enabled == true then
enabled = false
m = Instance.new("Hint",Workspace)
m.Text = "Your gift is down the hall son :)"
wait(5)
m:remove()
enabled = true
end
end

sp.Touched:connect(onTouched)
Report Abuse
PwnzaKing is not online. PwnzaKing
Joined: 19 Jul 2012
Total Posts: 14852
04 Jul 2014 07:11 PM
just go to kohls admin
and h/ your gift is down the hall son :)
ur welocme!'
Report Abuse
blox6137 is not online. blox6137
Joined: 23 Nov 2008
Total Posts: 1109
04 Jul 2014 08:07 PM
Wait, why is it
"m = Instance.new("Hint",Workspace)"
it should be
m = Instance.new("Message", Workspace)"
Also, try and capitalize things that need to be. Like the word 'remove'. Capitalize that, otherwise it slows down the script.


System32? Delete it.
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
04 Jul 2014 08:12 PM
sp = script.Parent
m = Instance.new("Hint")
db = false

function onTouched(hit)
if hit.Parent:findFirstChild("Humanoid") and db == false then
db = true
m.Text = "Your gift is down the hall son :)"
m.Parent = game.Workspace
wait(5)
m.Parent = nil
db = false
end
end

sp.Touched:connect(onTouched)
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