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)

4 comments
Is this a localscript?
Also see this page for where localscripts can be placed, and their limitations. http://wiki.roblox.com/index.php?title=API:Class/LocalScript
This is not in a LocalScript...
It needs to be a localscript for it to use the "LocalPlayer" function