DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 18 Apr 2015 08:41 AM |
| How do I make a script to where you step inside a block (The block is not CanCollided ) and a GUI pops up in the middle of you screen. Can someone help me? |
|
|
| Report Abuse |
|
|
Chrapnel
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 951 |
|
|
| 18 Apr 2015 08:43 AM |
have the gui invisible and use the Touched event to make it visible use the TouchEnded event to make it invisible again |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 18 Apr 2015 08:48 AM |
| I cant find anything on the wiki regurading touch events |
|
|
| Report Abuse |
|
|
Chrapnel
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 951 |
|
|
| 18 Apr 2015 08:50 AM |
| okay... is your gui in startergui? |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
| |
|
Chrapnel
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 951 |
|
|
| 18 Apr 2015 08:56 AM |
Place it on your screen where you want it to pop up and make sure that Visible is unchecked.
part = --part location here gui = --gui location here
part.Touched:connect(function() gui.Visible = true end
part.TouchEnded:connect(function() gui.Visible = false end |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 08:59 AM |
| That will make it global, use :GetPlayerFromCharacter() instead. |
|
|
| Report Abuse |
|
|
Chrapnel
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 951 |
|
|
| 18 Apr 2015 09:02 AM |
| ^ or put it in a localscript. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 09:19 AM |
Chrap
That doesn't work (Its an anonymous function)
therefor those ends need to be end) not end. |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 18 Apr 2015 09:20 AM |
part = brick--part location here gui = ScreenGUI--gui location here
part.Touched:connect(function() gui.Visible = true end
part.TouchEnded:connect(function() gui.Visible = false end
"Part" in line 8 is giving me a red line saying:
"Expected ')' (to close ')' at line 4) got,'part' |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 09:22 AM |
This is what I just said
Here:
part = brick--part location here gui = ScreenGUI--gui location here
part.Touched:connect(function() gui.Visible = true end)
part.TouchEnded:connect(function() gui.Visible = false end) |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
| |
|
|
| 18 Apr 2015 09:54 AM |
local debounce = false function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then debounce = true local player = getPlayer(human) if (player == nil) then return end script.Parent:clone().Parent = player.PlayerGui wait(2) debounce = false end end script.Parent.Parent.Touched:connect(onTouch)
put gui in brick with this in it
God grant me the wisdom to not punch stupid ppl, for I know I will go to prison. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 10:09 AM |
local gui = locationofgui local guiname = 'GUI name'' guib = false
script.Parent.Touched:connect(function(hit) if guib == false then local x = gui:Clone() x.Parent = game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui guib = true else script.Parent.TouchEnded:connect(function(hit) if guib == true then game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui[guiname]:remove() guib = false end end) end end)
Won't this work too?
~ All you need to know is that I'm an otaku |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 10:10 AM |
Dam double ''
~ All you need to know is that I'm an otaku |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 10:10 AM |
local guiname = 'GUI name' ***
~ All you need to know is that I'm an otaku |
|
|
| Report Abuse |
|
|