KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 21 Mar 2014 02:21 PM |
How do i get the player's playergui thruogh a touch of a brick? When you touch something, it is like an arm or something in the character, so how do you get the player with his/hers backpack and playergui? I got this far:
function OnTouched(player) gui = --how do i get the players playergui? gui.Visible = true repeat gui.Transparency = gui.Transparency - .001 wait(.01) until gui.Transparency == 0 end script.Parent.Touched:connect(OnTouched) |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 21 Mar 2014 02:23 PM |
function OnTouched(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local playerGui = player.PlayerGui end
|
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 02:23 PM |
function OnTouched(player) local Player = Game.Players:GetPlayerFromCharacter(player.Parent) if Player then local gui = Player.PlayerGui["NAME OF GUI"]["NAME OF GUIOBJECT DESCENDANT"] gui.Visible = true repeat gui.Transparency = gui.Transparency - .001 wait(.01) until gui.Transparency == 0
end end script.Parent.Touched:connect(OnTouched) |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 02:26 PM |
ok,first your gonna need to FIND the player
what the function will return is the "part" that touched it
function touch(thing) print(thing.Name) end
script.Parent.Touched:connect(touch)
output: Part Torso Head Left Arm
etc
so we want to "find the first child" in game.Players,that has the name
p = game.Players:findFirstChild(thing.Parent.Name) if p then--if it finds the player gui = p.PlayerGui.GuiName
so
function OnTouch(thing) p = game.Players:findFirstChild(thing.Parent.Name) if p then gui = p.PlayerGui.GuiName.TextLabel --continue end end script.Parent.Touched:connect(OnTouch) |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 21 Mar 2014 02:28 PM |
Knightmare's works thanks also thanks island for the lesson ;) |
|
|
| Report Abuse |
|
|
| |
|