generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script won't execute

Previous Thread :: Next Thread 
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
31 Dec 2015 11:37 PM
ServerScriptService*
Report Abuse
LicePro is not online. 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
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
31 Dec 2015 11:39 PM
@Lice

A lot of people do.
Report Abuse
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
31 Dec 2015 11:42 PM
not helping
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
31 Dec 2015 11:48 PM
you just reposted the same thing i put.
Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
31 Dec 2015 11:48 PM
Fake
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
31 Dec 2015 11:49 PM
Did you even try it?
Report Abuse
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
31 Dec 2015 11:50 PM
It still doesnt work aswell.
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
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
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
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
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
31 Dec 2015 11:58 PM
I did and obv. I didn't have the whole code, there is no if statement.
Report Abuse
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
01 Jan 2016 12:00 AM
And that is the whole code.
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
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 is not online. 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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
01 Jan 2016 12:02 AM
After it reaches the "repeat wait() until Player" it does not print("Hello") anymore
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
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
fireofflames95 is not online. fireofflames95
Joined: 07 Oct 2009
Total Posts: 1101
01 Jan 2016 12:04 AM
@Casualist, No avail
Report Abuse
Casualist is not online. 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
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
01 Jan 2016 12:08 AM
@Casualist

No, it wont. It's a property so it waits until the property ~= nil.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image