TheOsiris
|
  |
| Joined: 30 May 2010 |
| Total Posts: 4534 |
|
|
| 30 Dec 2015 10:00 PM |
Hi, I need help. I created a billboard gui that's attached to your head, but it only works in Studio. I am unsure why it does.
groupid = 1181615 game.Players.PlayerAdded:connect(onPlayerRespawned) function onPlayerRespawned(newPlayer) wait(1) if newPlayer:IsInGroup(groupid) then gui=Instance.new("BillboardGui") gui.Parent=newPlayer.Character.Head gui.Adornee=newPlayer.Character.Head gui.Size=UDim2.new(4,0,2,0) gui.StudsOffset=Vector3.new(0,3,0) texta=Instance.new("TextBox") texta.Size=UDim2.new(1,0,1,0) texta.BackgroundTransparency = 1 texta.TextColor3 = Color3.new(0,0.5,1) texta.Font = "SourceSansLight" texta.FontSize = "Size24" texta.Text = (game.Players.LocalPlayer.Name .. " || " .. newPlayer:GetRoleInGroup(groupid) .. "") texta.Parent=gui w = game.Lighting.WepsGroup:GetChildren() for i = 1,#w do w[i]:Clone().Parent = newPlayer.Backpack end end end
function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onPlayerRespawned(newPlayer) end end) end
game.Players.PlayerAdded:connect(onPlayerEntered)
|
|
|
| Report Abuse |
|
|
FlyNormal
|
  |
| Joined: 30 Sep 2015 |
| Total Posts: 344 |
|
|
| 30 Dec 2015 10:05 PM |
Any error(s)? The possible error is that you have not waited for the head to load.
Use this way for waiting, it's better:
local character = player.CharacterAdded:wait() or player.Character local head = character:WaitForChild("Torso") |
|
|
| Report Abuse |
|
|
TheOsiris
|
  |
| Joined: 30 May 2010 |
| Total Posts: 4534 |
|
|
| 30 Dec 2015 10:12 PM |
Fly, Workspace.Script:4: attempt to index global 'player' (a nil value)
|
|
|
| Report Abuse |
|
|
13Jayson
|
  |
| Joined: 05 Jun 2012 |
| Total Posts: 1682 |
|
|
| 30 Dec 2015 10:19 PM |
Idk, I had the same probleme of something else and it was because on studio u load faster than the script, so im pretty sure in the game... the script is faster...
Not 100% sure though, plus that was almost year ago so... You should think about it if you didn't .o.
Meeooow!!!!!!13!!! |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 10:22 PM |
"Not 100% sure though, plus that was almost year ago"
You got the point across, but let me make it a little more specific.
In Studio, everything is already loaded, you don't need to wait for anything. In a game, things take time to stream and load and the like, and your character can take a few seconds to actually spawn. |
|
|
| Report Abuse |
|
|
13Jayson
|
  |
| Joined: 05 Jun 2012 |
| Total Posts: 1682 |
|
|
| 30 Dec 2015 10:25 PM |
@Jar
Heh, I am bad at explaining, plus my native language isn't english so... It's a bit harder for me xd
Meeooow!!!!!!13!!! |
|
|
| Report Abuse |
|
|