|
| 31 Dec 2015 11:36 PM |
When I test the script in roblox studio, it works, the gui is shown overhead, and I can see my game, however, when I upload it to roblox and join the game, it doesnt show whatsoever. I have the script in the ServerScruotServer section.
local GroupId = 2521723
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Head") local plr = game.Players.LocalPlayer local head = plr.Character.Head if plr:IsInGroup(GroupId) then local gui = Instance.new("BillboardGui", head) gui.Adornee = head gui.Size = UDim2.new(100,0,1,0) gui.StudsOffset = Vector3.new(0,2,0) gui.Name = "RankGui" local rank = Instance.new("TextLabel", gui) rank.Name = "Rank" rank.BackgroundTransparency = 1 rank.BorderSizePixel = 0 rank.ZIndex = 2 rank.Font = "ArialBold" rank.Text = plr:GetRoleInGroup(GroupId) rank.Size = UDim2.new(1,0,1,0) rank.FontSize = "Size18" rank.TextColor3 = Color3.new(1,1,1) rank.TextStrokeColor3 = Color3.new(0,0,0) rank.TextStrokeTransparency = 0 rank.TextScaled = true rank.TextWrapped = false end |
|
|
| Report Abuse |
|
|
| |
|
LicePro
|
  |
| Joined: 08 Dec 2015 |
| Total Posts: 467 |
|
|
| 31 Dec 2015 11:38 PM |
| Why are you using repeat and until on the same line... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 31 Dec 2015 11:44 PM |
local Player = game.Players.LocalPlayer repeat wait() until Player local Character = Player.Character or Player.CharacterAdded:wait() local Head = Character.Head local gui = Instance.new("BillboardGui", Head) gui.Adornee = Head gui.Size = UDim2.new(100,0,1,0) gui.StudsOffset = Vector3.new(0,2,0) gui.Name = "RankGui" local rank = Instance.new("TextLabel", gui) rank.Name = "Rank" rank.BackgroundTransparency = 1 rank.BorderSizePixel = 0 rank.ZIndex = 2 rank.Font = Enum.Font.ArialBold rank.Text = tostring(plr:GetRoleInGroup(GroupId)) rank.Size = UDim2.new(1,0,1,0) rank.FontSize = "Size18" rank.TextColor3 = Color3.new(1,1,1) rank.TextStrokeColor3 = Color3.new(0,0,0) rank.TextStrokeTransparency = 0 rank.TextScaled = true rank.TextWrapped = false |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:48 PM |
| you just reposted the same thing i put. |
|
|
| Report Abuse |
|
|
LicePro
|
  |
| Joined: 08 Dec 2015 |
| Total Posts: 467 |
|
| |
|
| |
|
|
| 31 Dec 2015 11:50 PM |
| Yes I tried it, and I compared what you wrote to what I wrote, and you just copy and pasted. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:50 PM |
| It still doesnt work aswell. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:50 PM |
| No, I didn't. Look at the first few lines, it's more efficient. You also had an unneeded end. I need the output if I am to help you. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:53 PM |
You didnt change anything to what I posted on the forum, besides remove the part that said "local GroupId = 2521723" which is essential to showing the rank in the group I am trying to show. The ending is still the same aswell. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:54 PM |
| No, it isn't. I am done arguing. Add the groupId line back to the top, I missed that part. Then, it should work. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:57 PM |
I am not arguing with you, removing the end at the end of the if statement gives you the error,
"ServerScriptService.Overhead ranks:26: 'end' expected (to close 'if' at line 6)'"
other than that, you didn't change the original code, and the script still doesnt work. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:58 PM |
| I did and obv. I didn't have the whole code, there is no if statement. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2015 11:59 PM |
Nevermind, I'm a fool, I was wrong.
However, the script you sent me still does not work. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 12:00 AM |
| And that is the whole code. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 12:00 AM |
| Hmm... Add prints every few lines, and tell me where it stopped working. This may seem stupid but it's actually a popular method of debugging code. |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 01 Jan 2016 12:02 AM |
| You can't get the local player from a server script. Use a local script and throw this into StarterGui |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 12:02 AM |
After it reaches the "repeat wait() until Player" it does not print("Hello") anymore
|
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 12:03 AM |
Didn't see that casualist.
OP your problem is that your using this in a serverscript; insert a localscript in StarterGui with my code in it, and it should work fine. |
|
|
| Report Abuse |
|
|
| |
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 01 Jan 2016 12:05 AM |
In studio mode client and server are one, so Players.LocalPlayer is defined in studio mode. Online, Players.LocalPlayer is only defined for the client
"local Player = game.Players.LocalPlayer repeat wait() until Player"
This is a terrible approach besides because if Player is initially nil it'll loop forever, it should be
repeat wait() until game.Players.LocalPlayer local Player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2016 12:08 AM |
@Casualist
No, it wont. It's a property so it waits until the property ~= nil. |
|
|
| Report Abuse |
|
|