|
| 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 |
|
|
| |
|
| |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 13 Jan 2011 |
| Total Posts: 7443 |
|
|
| 04 Nov 2014 05:56 PM |
wait(math.huge)
print("Hello World!") |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2014 06:28 PM |
Where do i place it??
i tried at end and didn't work |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 04 Nov 2014 08:02 PM |
Thank you soooooo much!!!
Works perfect =DDDD |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|