|
| 03 Mar 2012 04:45 AM |
This is for general GUIs. My example is showing a teleport GUI to a place in my server. I only want it shown for certain people and it can be activated by those certain people, obviously onClicked. So I need help on how to make the script able to identify that players name and allow ONLY them to see and activate the GUI and for ordinary players, they won't see that certain GUI.
Here is the script I randomly made.
torso = script.Parent.Parent.Parent.Parent.Character.Torso --Defining the torso.
function onClicked(GUI) --What happens when you click the button torso.CFrame = CFrame.new(Vector3.new(2645, 575.6, 724)) --Teleports the player to the specified coordinates. end
script.Parent.MouseButton1Click:connect(onClicked) --Activated when a player clicks on the GUI. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 06:14 AM |
| Nobody? Pleeease give it a try. |
|
|
| Report Abuse |
|
|
Ultraw
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 6575 |
|
|
| 03 Mar 2012 06:22 AM |
hmm..
make a different script with this
function onenter(p) gui = game.Lighting.GUINAMEHERE if p:IsBestFriendsWith(your id here) gui:Clone().Parent = p.PlayerGui end end game.Players.ChildAdded:connect(onenter) |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 06:31 AM |
| Is there anyway of doing it than making them my best friend? How would I be able just to their name in the script but still add all that stuff in lighting? |
|
|
| Report Abuse |
|
|
Ultraw
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 6575 |
|
|
| 03 Mar 2012 06:41 AM |
there would be a way hmm
maybe instead of the line with the best friend thing on, replace it with this
if p.Name == "thesomektime" or p.Name == "guy" or p.Name = "whatever" then |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 06:43 AM |
| That sounds like it would work to me, I will go ahead and try it now and inform you if it has worked or not. Thank you very much, sorry for getting you no where with your post earlier today... =/ |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 06:44 AM |
| One more thing, where would that script go? I would add GUI in Lighting with all the scripts inside of that? |
|
|
| Report Abuse |
|
|
Ultraw
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 6575 |
|
|
| 03 Mar 2012 06:46 AM |
my script into workspace
gui into lighting the teleport script, keep it where it was
done.
|
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 07:11 AM |
| You forgot one "=". I added another one but I dont think thats why it doesnt work. I think it might be the placement. I added a "ScreenGUI" into Lighting. I called it what I wanted and then replaced the YOURGUINAME to what I named it. I inserted your script into Workspace. Now with the screenGUI which is in the Lighting. I inserted a text button into the ScreenGUI then put my teleport script inside that text button. So I only inserted things into Lighting and Workspace. Did you spot anything wrong? |
|
|
| Report Abuse |
|
|
Ultraw
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 6575 |
|
|
| 03 Mar 2012 09:05 AM |
| no, does my script have any output? |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 09:43 AM |
| No, there is no output for anything saying that there is an error. Shall I print the screen and upload it so you can see a few? |
|
|
| Report Abuse |
|
|
kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
|
| 03 Mar 2012 09:57 AM |
Moving the torso would kill them try :MoveTo(Vector3.new(1,1,1))
Yeah so to check you would.
allow = {"Bob","Bobby","BobbyBobbo"} --Insert Names
function Click_Check_Tele() local Body = script.Parent.Parent.Parent.Character --[[How many parents is ther befor you reach player?]] local Name = script.Parent.Parent.Parent.Name --[[How many agian?]] for _, user in pairs(allow) do if Name:lower() == allow:lower() then --Wow that's the first time I did that. Body:MoveTo(CFrame.new(X,Y,Z)) --Insert position end end end
script.Parent.MouseButton1Down:connect(Click_Check_Tele) --I dunno if this will work, first times I'm doing tables and _, stuff. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:02 AM |
| @kools What exactly does your script do and what is it a replacement for? |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:16 AM |
Alright, first put a script in workspace. Its source should be:
allowed = {["thesomektime"] = true, ["ElectricBlaze"] = true} guiname = "ScreenGui" --CHANGE TO THE GUI'S NAME game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if allowed[player.Name] then script[guiname]:clone().Parent = player.PlayerGui end end) end)
Then place the GUI in that script. Not StarterGui, the script. Place a LocalScript in the TextButton in the GUI. The LocalScript's source should be:
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:conenct(function() player.Character:MoveTo(Vector3.new(2645, 575.6, 724)) end)
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:41 AM |
When you told me to place the GUI in the script, does that mean I don't touch Lighting? Everything should be added in Workspace? Would it look something like this?
Workspace>FirstScript>ScreenGUI>LocalScript. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:42 AM |
Sorry.
Workspace>FirstScript>ScreenGUI>TextButton>LocalScript.
|
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:43 AM |
Shouldn't you have a TextButton in the ScreenGui? That's the only what you could click it. It should be:
Workspace -> Script -> ScreenGui -> TextButton -> LocalScript
Also, in the first script remember to change the `guiname` variable to the name of the ScreenGui.
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:43 AM |
Latepost. Yes, the second one is correct.
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:47 AM |
Oh, also, I noticed a typo I made in the LocalScript. Change it to:
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() player.Character:MoveTo(Vector3.new(2645, 575.6, 724)) end)
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:51 AM |
| I noticed the typo while I put in the script too. =P I changed it already, thanks so much. Btw, you're an AMAZING scripter. Heard a lot about you. Thanks for helping me out, I will get back to you if it worked or didn't work. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 11:57 AM |
| Btw, if I were to make more of these but with different positions of course. Would it break the scripts if I modeled them together? Btw it worked, you won the post. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 12:02 PM |
No, the position doesn't matter, as long as you put it in as a Vector3 value. The MoveTo method can't use CFrames. :P
No problem, by the way.
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 12:09 PM |
Or actually I dont like having a lot of models too. Would it work if on the first script, I just add another line saying, "guiname = "ScreenGUI" "
Would that work, and then I repeat the steps but just add the new screenGUIs name onto the first script? Does that make sense? |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2012 12:14 PM |
Wait, what are you asking? For the script to move multiple GUIs?
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2012 06:19 AM |
No no, it's fine, I think I figured that one on my own. Thanks a lot though.
WINNER OF THIS POST : ElectricBlaze |
|
|
| Report Abuse |
|
|