FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 23 Mar 2012 04:03 PM |
script.Parent.ClickDetector.Mouseclick:connect(function(plr) Instance.new("GUI",Workspace) gui.Position = UDim2.new(0.75, 0, 0.6, 0) end)
Would this work? I tested it and no GUI displays.
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
| |
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 23 Mar 2012 04:10 PM |
...
I'm sorry but I have relatively no idea what "call" and those type of things mean. I'm only just learning to script.
Do you think you could explain it in a simpler way?
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
EMAN381
|
  |
| Joined: 27 Nov 2007 |
| Total Posts: 4300 |
|
|
| 23 Mar 2012 04:33 PM |
script.Parent.ClickDetector.Mouseclick:connect(function(plr) Instance.new("GUI",Workspace) gui.Position = UDim2.new(0.75, 0, 0.6, 0) end)
Don't listen to that guy, you did call the function. (call = said)
One thing you said was 'Instance.new("GUI",Workspace)'. Two things wrong about that:
1. 'Gui' should be ScreenGui 2. If you put it in the workspace, no player will see it.
Another thing is the "script.Parent.ClickDetector.Mouseclick:connect" all that will do is call a function that can't know who the player really is. It's stupid, I know, but for some reason ROBLOX never scripted ClickDetectors to find the player who clicked it. I suggest you have an OnTouch() method to do this. To fix this, You should do:
function onTouch(hit) --Just because you need to say 'hit' in this
Then, another thing is that you didn't say what 'gui' is in 'gui.Position'. I will fix this later so you can understand what you need to do next.
The workspace is pretty much where all the objects are. You need to put it in the player, so do to this, let's go rewrite some of the script:
function onTouch(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then --If this is a humanoid, or player touching this, then, local player = game.Players:GetPlayerFromCharacter(hit.Parent) --This will go to the player's 'Player', like where the backpack and Guis are if player ~= nil then --If there is a player, then, gui = Instance.new("ScreenGui", player.PlayerGui) --This puts a Gui in a player gui.Name = "BLAHBLAHBLAH" --Change the name here
That just fixed part of the situation. We're not done. The 'gui.Position' will not work because the 'gui' is a ScreenGui; you need an object that can have its position moved. So:
guipart = Instance.new("Frame", gui)
This puts a Frame object in the Gui. So, we should have it as:
guipart.Position = UDim2.new(0.75, 0, 0.6, 0)
Now the gui part will move to your position.
Now we need to add 'end's to the function. *adds*
Then to use the connect, just write:
script.Parent.Touched:connect(onTouch)
Now, we're all done! Here is the full script:
function onTouch(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then --If this is a humanoid, or player touching this, then, local player = game.Players:GetPlayerFromCharacter(hit.Parent) --This will go to the player's 'Player', like where the backpack and Guis are if player ~= nil then --If there is a player, then, gui = Instance.new("ScreenGui", player.PlayerGui) --This puts a Gui in a player gui.Name = "BLAHBLAHBLAH" --Change the name here guipart = Instance.new("Frame", gui) --Adds part guipart.Position = UDim2.new(0.75, 0, 0.6, 0) end end end
script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
EMAN381
|
  |
| Joined: 27 Nov 2007 |
| Total Posts: 4300 |
|
|
| 23 Mar 2012 04:37 PM |
Any questions or errors, tell me.
I know your way of calling the function was easier, but I thought you couldn't call the 'hit', and now I just realized that I could've said 'script.Parent.Touched:connect(function(hit)' and put that last 'end' with a ')'.
But oh well. |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 23 Mar 2012 06:01 PM |
So when I'm actually building the gui, what should I do? How do I insert them into the gui using the script?
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 06:06 AM |
Bump for helps...
I tried to make the GUI appear.
But it didn't.
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 24 Mar 2012 06:17 AM |
ClickDetectors CAN find who clicked.
function click(player) -Stuuff end Connection line.
it's 1st argument
and, the GUI won't show cuz there's no GUI, there's nothing inside it. Insert a textlabel or something. |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 06:31 AM |
Oh yeah sorry.
function click(Player) if click.Parent:FindFirstChild("Humanoid") ~= nil then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then gui = Instance.new("ScreenGui", player.PlayerGui) gui.Name = "Teleporter" guiframe = Instance.new("Frame", gui) guipart.Position = UDim2.new(0.75, 0, 0.6, 0) game.Players.GetPlayerFromCharacter(click.Parent).PlayerGUI.Teleporter.Size = UDim2.new(1, 0, 1, 0) end end end script.Parent.Clicked:connect()
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 06:33 AM |
Alright now it doesn't do anything.
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 24 Mar 2012 06:38 AM |
" game.Players.GetPlayerFromCharacter(click.Parent).PlayerGUI.Teleporter.Size = UDim2.new(1, 0, 1, 0)" That'd work, but you could just write "guipart.Size = UDim2.new(1,0,1,0) And since you're making it full screen, get rid of the line which positions it.
"script.Parent.Clicked:connect()" Unless script.Parent is a clickdetector, that should be "script.Parent.ClickDetector.MouseClick:connect(click)".
Also, urgh...instead of explaining, sorry, I'mma just fix your code (lazy 2day).
function click(Player) if click.Parent:FindFirstChild("Humanoid") ~= nil then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then gui = Instance.new("ScreenGui", player.PlayerGui) gui.Name = "Teleporter" guiframe = Instance.new("Frame", gui) guipart.Position = UDim2.new(0.75, 0, 0.6, 0) game.Players.GetPlayerFromCharacter(click.Parent).PlayerGUI.Teleporter.Size = UDim2.new(1, 0, 1, 0) end end end
script.Parent.Clicked:connect()
Aww...it came out as one line...nvm. I hope a nice Robloxian will help you out. I'm just to tired... |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 07:36 AM |
function onTouch(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then gui = Instance.new("ScreenGui", player.PlayerGui) gui.Name = "Teleporter" background = Instance.new("Frame", gui) background.Size = UDim2.new(1,0,1,0) exitbutton = Instance.new("Text Button", background) -- Do I insert into background or gui or something else? I want it to be relative to the "background" exitbutton.Size = UDim2.new(0.1,0,0.3,0) exitbutton.Text = "Exit" end end end
script.Parent.Touched:connect(onTouch)
--I got it to show up. Only problem is... It doesn't show the "exitbutton"
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 24 Mar 2012 07:48 AM |
| You'd have to add a script if you wanted an exit button. Instead of an exit button, how about adding it to the debris? |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
| |
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 07:50 AM |
Well I just want to exit button to be displayed, not scripted yet, I know what I'm doing for that.
Do I have to make a whole other script just for an exit button?
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 07:53 AM |
exitbutton = Instance.new("Text Button", gui) exitbutton.Size = UDim2.new(0.1,0,0.3,0) exitbutton.Text = "Exit"
There is that part of the script. It doesn't display.
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 07:58 AM |
I fixed it...
TextButton is one word...
T_T
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 09:38 AM |
If I wanted to script the exit button to destroy the GUI, what would that look like?
And can I edit the font/fontsize of the exitbutton? I've tried:
exitbutton.Font = ArialBold exitbutton.FontSize = Size24
and it doesn't work.
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2012 09:40 AM |
try something more like and then check with print what is the font and fontsize increase 1 as you are testing I am not sure which is which but you should get it in a min exitbutton.Font = 1 exitbutton.FontSize = 2 |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 24 Mar 2012 11:42 AM |
Doesn't work...
⊂=-҉Ξ҉-=⊃ I'm the kinda guy who laughs at a funeral, can't understand what I mean, well soon you will. ⊂=-҉Ξ҉-=⊃ |
|
|
| Report Abuse |
|
|