Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Paste GUI into localplayer?

Asked by
iNicklas 215 Moderation Voter
8 years ago

Its a level up gui that will pop up, then go nil afterwards. But it doesn't above the Local Player's Head

local player = game.Players.LocalPlayer.Character

local gui = Instance.new("BillboardGui",workspace)
    gui.Name = "LEVELUP"
    gui.Size = UDim2.new(5,0,2,0)
    gui.ExtentsOffset = Vector3.new(0,8,0)
        Instance.new("Frame",gui)
        gui.Frame.Size = UDim2.new(1,0,2,0)
        gui.Frame.BorderSizePixel = 0

local Image     = Instance.new("ImageLabel",gui.Frame)

Image.BorderSizePixel           = 2
Image.BorderColor3              = Color3.new(20/255,20/255,20/255)
Image.Size                      = UDim2.new(1,0,1,0)
Image.Image                     = "rbxassetid://167251759"

local TextLabel = Instance.new("TextLabel",gui.Frame)

TextLabel.Size                      = UDim2.new(1,0,1,0)
TextLabel.Font                      = "ArialBold"
TextLabel.Text                      = "LEVEL UP"
TextLabel.FontSize                  = Enum.FontSize.Size28
TextLabel.TextScaled                = true
TextLabel.TextWrapped               = true
TextLabel.BackgroundTransparency    = 1
TextLabel.TextStrokeColor3          = Color3.new(100/255,100/255,100/255)
TextLabel.TextStrokeTransparency    = 0
TextLabel.TextColor3                = Color3.new(255/255,200/255,50/255)
TextLabel.BorderSizePixel           = 0

gui.Parent = player.Head

wait(5)

gui.Parent = nil
0
Your code seemed to run fine in my testing. Are you using a LocalScript and where are you trying to run it from? NullSenseStudio 342 — 8y
0
The script is in workspace, and its localscript iNicklas 215 — 8y
0
You have to set the GUI's Adornee! Shawnyg 4330 — 8y
0
A LocalScript won't run under Workspace unless it's in a character Model. NullSenseStudio 342 — 8y
0
What is Adornees for? iNicklas 215 — 8y

1 answer

Log in to vote
0
Answered by
Wutras 294 Moderation Voter
8 years ago
local player = game.Players.LocalPlayer.Character -- Here we got the problem.

local gui = Instance.new("BillboardGui",workspace)
    gui.Name = "LEVELUP"
    gui.Size = UDim2.new(5,0,2,0)
    gui.ExtentsOffset = Vector3.new(0,8,0)
        Instance.new("Frame",gui)
        gui.Frame.Size = UDim2.new(1,0,2,0)
        gui.Frame.BorderSizePixel = 0

local Image     = Instance.new("ImageLabel",gui.Frame)

Image.BorderSizePixel           = 2
Image.BorderColor3              = Color3.new(20/255,20/255,20/255)
Image.Size                      = UDim2.new(1,0,1,0)
Image.Image                     = "rbxassetid://167251759"

local TextLabel = Instance.new("TextLabel",gui.Frame)

TextLabel.Size                      = UDim2.new(1,0,1,0)
TextLabel.Font                      = "ArialBold"
TextLabel.Text                      = "LEVEL UP"
TextLabel.FontSize                  = Enum.FontSize.Size28
TextLabel.TextScaled                = true
TextLabel.TextWrapped               = true
TextLabel.BackgroundTransparency    = 1
TextLabel.TextStrokeColor3          = Color3.new(100/255,100/255,100/255)
TextLabel.TextStrokeTransparency    = 0
TextLabel.TextColor3                = Color3.new(255/255,200/255,50/255)
TextLabel.BorderSizePixel           = 0

gui.Parent = player.Head

wait(5)

gui.Parent = nil

If a script tries getting the LocalPlayer then it HAS to be in the player. So if this script is in workspace then the LocalPlayer will be nil, causing the rest of this script to break. Just put this entire script into StarterGui and modify it to your likings, hope this has helped.

0
I'm actually just editing the pesky level up message u get with the rpg starter kits. So this is a script inside ServerScriptService iNicklas 215 — 8y
0
Then you'll need another way of getting the player. Wutras 294 — 8y
Ad

Answer this question