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

Clone GUI from Lighting to LocalPlayer PlayerGui, not working?

Asked by
thePyxi 179
9 years ago

Hi, me again with another Cloning GUI question. Like I said before, cloning GUI's if my weakest point. This is in a StarterGUI for the game. Once the button has been pressed it should run these commands and clone a GUI from Lighting to the Player only, but it keeps saying "Players.Zhoxic.PlayerGui.Starting.Background.PButton.Script:13: attempt to index field 'LocalPlayer' (a nil value)"

function onClicked(gui) 
    while script.Parent.TextStrokeTransparency <=1 do
        wait(0.02)
        script.Parent.Parent.BackgroundTransparency = script.Parent.Parent.BackgroundTransparency + 0.02
        script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + 0.02
        script.Parent.TextTransparency = script.Parent.TextTransparency + 0.02
        script.Parent.TextStrokeTransparency = script.Parent.TextStrokeTransparency + 0.02
        print(1)
    end
print(2)
    script.Parent.Position = UDim2.new(5,0,5,0)
    print(3)
game.Lighting.Menu1:Clone().Parent = game.Players.LocalPlayer.PlayerGui
print(4)
print("Play")
end
script.Parent.MouseButton1Down:connect(onClicked)
0
Is this a localscript? magiccube3 115 — 9y
0
Also see this page for where localscripts can be placed, and their limitations. http://wiki.roblox.com/index.php?title=API:Class/LocalScript magiccube3 115 — 9y
0
This is not in a LocalScript... thePyxi 179 — 9y
3
It needs to be a localscript for it to use the "LocalPlayer" function Wizzy011 245 — 9y

Answer this question