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: 1 time use only?

Previous Thread :: Next Thread 
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 04:03 PM
How do i make it so that you can only use this once?

function message(m)




m.Text = "Wow, It's really dark down here.."
wait(3)


end
function onTouch(hit)

if hit.Parent:FindFirstChild("Humanoid") ~= nil then

if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then
local player = game.Players:FindFirstChild(hit.Parent.Name)

if player:FindFirstChild("PlayerGui"):FindFirstChild("ScreenGui") == nil then
sg = Instance.new("ScreenGui")
sg.Parent = player:FindFirstChild("PlayerGui")
end

if player.PlayerGui.ScreenGui:FindFirstChild("MessageBox") == nil then


local f = Instance.new("Frame")
f.Name = "MessageBox"
f.Position = UDim2.new(0.5, 0, 0.75, 0)
f.Size = UDim2.new(0,0,0)
f.Style = "RobloxRound"
f.Parent = player.PlayerGui:FindFirstChild("ScreenGui")

local m = Instance.new("TextLabel")
m.Position = UDim2.new(0.5, 0, 0.5, 0)
m.FontSize = "Size14"
m.TextColor3 = Color3.new(1,1,1)
m.Parent = f

message(m)


f:Destroy()
script.Parent.Part:Destroy()
end
end
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 04:20 PM
b
Report Abuse
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 04:56 PM
please help
Report Abuse
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 05:31 PM
=/
Report Abuse
shooter06 is not online. shooter06
Joined: 13 Jan 2011
Total Posts: 7443
04 Nov 2014 05:39 PM
keep the destroy or make a math.huge wait


print("Hello World!")
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
04 Nov 2014 05:43 PM
Depends on what you're trying to get rid of.
add script.Parent:Destroy() or script.Parent.Parent:Destroy() to the end. Not sure which you want.
Report Abuse
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 05:46 PM
well it only destroy the text when i walk into the brick


like i walk into the brick and it says "hello" then if i walk through again it still says it



i need it so u can only use it once








Report Abuse
shooter06 is not online. shooter06
Joined: 13 Jan 2011
Total Posts: 7443
04 Nov 2014 05:56 PM
wait(math.huge)


print("Hello World!")
Report Abuse
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 06:28 PM
Where do i place it??

i tried at end and didn't work
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
04 Nov 2014 06:48 PM
Try replacing
script.Parent.Part:Destroy()
with
script.Parent.Parent:Destroy()
Report Abuse
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 07:09 PM
didn't work still everytime i walk through the block the message still pops up

please help
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
04 Nov 2014 07:13 PM
The block is inside script.Parent.Parent
If you deleted that then the script, the block, should all be gone. Also I think you meant to do script.Parent:Destroy() instead of script.Parent.Parent:Destroy().
Report Abuse
BuildAndRaceBuilders is not online. BuildAndRaceBuilders
Joined: 10 Dec 2012
Total Posts: 250
04 Nov 2014 08:02 PM
Thank you soooooo much!!!


Works perfect =DDDD
Report Abuse
purplescheer9 is not online. purplescheer9
Joined: 16 Jan 2011
Total Posts: 3852
04 Nov 2014 08:06 PM
You could have also added a value and set it to false which would be set to true once used. It would be like a debounce that you don't set it back to true/false

~I like trees
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