|
| 07 Aug 2014 10:03 PM |
| I am fairly new to scripting and i have succesfully made a brick that one touched creates or uses a Gui, however i have encountered some difficulties, i have no idea what to script in that makes the Gui disappear on the touching of the brick once more. I would like help please. |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 10:45 PM |
The wiki should cover basic touching events
http://wiki.roblox.com/index.php?title=Touched_(Event) |
|
|
| Report Abuse |
|
|
ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
| |
|
|
| 07 Aug 2014 10:50 PM |
This is my script
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then plr = game.Players:GetPlayerFromCharacter(hit.Parent) script.Parent.Gui:Clone().Parent = plr.PlayerGui end end end) |
|
|
| Report Abuse |
|
|
ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
|
| 07 Aug 2014 10:57 PM |
try making it visible/not visible.
plr.PlayerGui.Gui.Frame.Visible = not plr.PlayerGui.Gui.Frame.Visible |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:03 PM |
| It did not seem to work, i am getting a problem that when i walk over it it continues to put gui's up, the gui is on the whole screen and slightly transparent but with all of the guis of that shade popping up it blocks the screen |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:05 PM |
I didn't even test this local first = false; script.Parent.Touched:connect(function(hit) if not first == true then first = true; if hit.Parent:FindFirstChild("Humanoid") ~= nil then if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then plr = game.Players:GetPlayerFromCharacter(hit.Parent); if first == true then script.Parent.Gui:Clone().Parent = plr.PlayerGui; else plr.PlayerGui.Gui:Destroy(); end end end end end) |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:07 PM |
| Should i make that a seperate script... or add it to my script? or make a new script to replace mine, im new to this as i said so im not enirely sure. |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:14 PM |
I somehow get the feeling that it almost worked... but not quite, the Gui's have stopped
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:16 PM |
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then plr = game.Players:GetPlayerFromCharacter(hit.Parent) local G = script.Parent.Gui:Clone() G.Parent = plr.PlayerGui end end end)
script.Parent.Gui:Clone().Parent = plr.PlayerGui was always too buggy for my tastes, and you can condense ends |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:19 PM |
| Please good sir tell me where to put thou script! |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:21 PM |
This script is somethign i threw together since i had no commands, anyone wanna help with it?
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then plr = game.Players:GetPlayerFromCharacter(hit.Parent) script.Parent.Gui:Clone().Parent = plr.PlayerGui local first = true; script.Parent.Touched:connect(function(hit) if not first == false then first = true; if hit.Parent:FindFirstChild("Humanoid") ~= nil then if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then plr = game.Players:GetPlayerFromCharacter(hit.Parent); if first == true then script.Parent.Gui:Clone().Parent = plr.PlayerGui; else plr.PlayerGui.Gui:Destroy(); end end end end end end) |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:22 PM |
| in the brick that your touching |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:24 PM |
| Let me try to make my problem clear, I am getting the Gui to appear, my problem is i want to be able to touch the brick to make it disappear as well as appear and this is proving difficult. |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:36 PM |
OHHH well why didn't you say so.
Gui = "ScreenGui" --Change name to name of gui
DB = 0 script.Parent.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") then if DB == 0 then DB = 1 local P = game.Players:GetPlayerFromCharacter(hit.Parent) if not P.PlayerGui:findFirstChild(Gui) then local G = script.Parent[Gui]:Clone() G.Parent = P.PlayerGui else P.PlayerGui[Gui]:Destroy() end end end wait(1) DB = 0 end) |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:37 PM |
| I already tested it for you and it works fine. Just shove the script and gui into the same brick. |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:44 PM |
| Sorry that didnt work either, i have gotta ge tsoem sleep please tell me any methods you find, thank you all for your help! |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 11:47 PM |
If it didn't work then it's because you didn't follow the intructions. First, you have to change the variable at the top to the name of the gui itself. Second, you must place BOTH the Script and the ScreenGui into the same part. I already tested this script and it did work. If you're going to ask for help, you have to learn to listen. |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Aug 2014 08:58 AM |
| Thank you so much! it worked |
|
|
| Report Abuse |
|
|