XhymbbQd6
|
  |
| Joined: 22 Jul 2011 |
| Total Posts: 1468 |
|
|
| 09 Aug 2012 06:14 PM |
hiter = hit.Parent.LocalPlayer
function hit() hiter.PlayerGui.TTSB.MainFrame.Visible = true end
when a player touches it, it shows a Gui. whats wrong with this? |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2012 06:16 PM |
There are many things wrong with this, but it seems like you got your pathing correct.
function hit(part) if game.Players:GetPlayerFromCharacter(part.Parent) then -- checks if it's a Player local p = game.Players:GetPlayerFromCharacter(part.Parent) [.PlayerGui.TTSB.MainFrame.Visible = true end end
script.Parent.Touched:connect(hit) |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2012 06:17 PM |
That there is no actually way to determine if it has been hit or not. That is your problem :P. |
|
|
| Report Abuse |
|
|
XhymbbQd6
|
  |
| Joined: 22 Jul 2011 |
| Total Posts: 1468 |
|
|
| 09 Aug 2012 06:26 PM |
| I forgot the connection line xD god thats a rookie mistake. but thank you... I am new to going into the Players file. |
|
|
| Report Abuse |
|
|
djdjdj
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 10 |
|
| |
|
iAdobe
|
  |
| Joined: 22 May 2011 |
| Total Posts: 367 |
|
|
| 09 Aug 2012 06:43 PM |
hiter = hit.Parent.LocalPlayer -- Won't work, defined before the function? Not Sure, and it's not a valid way to find the player, anyways! this would only work on localscript!
function hit() hiter.PlayerGui.TTSB.MainFrame.Visible = true -- You're getting there. end
function Touched(Hit) -- Hit is the argument needed for the touched connection line. if Hit.Parent:FindFirstChild("Humanoid") then -- checks if it's a humanoid local Player = Game.Players:FindFirstChild(Hit.Parent.Name) -- finds the name if Player then -- makes sure it's there if not Player.PlayerGui.TTSB.MainFrame.Visible then -- Makees sure Gui isn't visible already Player.PlayerGui.TTSB.MainFrame.Visible = true end end end end
Game.Workspace.Part.Touched:connect(Touched)
Now there's a lot of ways to do this, I just perfer doing it like that. |
|
|
| Report Abuse |
|
|
XhymbbQd6
|
  |
| Joined: 22 Jul 2011 |
| Total Posts: 1468 |
|
|
| 09 Aug 2012 06:54 PM |
| Wait.. what? Sorry I didn't understand it. |
|
|
| Report Abuse |
|
|
iAdobe
|
  |
| Joined: 22 May 2011 |
| Total Posts: 367 |
|
| |
|