local Player = game:GetService('Players').LocalPlayer local PlayerGui = Player:WaitForChild('PlayerGui') local Commands = {} function Commands.FadeShop() local FadeFrame = Instance.new('Frame',PlayerGui) FadeFrame.Size = UDim2.new(0,10,0,10) for i = 1,0,-.1 do wait(.1) FadeFrame.BackgroundTransparency = i end end return Commands
Player is a Nil Value(Error)
I am sorry this question was deleted by accident D:
Use GetCharacterFromPlayer().
You can cycle through all the players in a game like below...
for i, v in pairs(game.Players:GetChildren()) do --i for index, v for reference to player if(v.Name == "PlayerNameHere") then --set-up gui or do whatever you want here end end --If you want to do it for all the players then just remove the if statement for i, v in pairs(game.Players:GetChildren()) do --i for index, v for reference to player --set-up gui or do whatever you want here end
I'm not sure if script.Parent.Parent.Parent will work, and personally I think that is more confusing. This is the ideal way to do, either do the same thing for all players, or search through the players for that particular player you want to modify things under.
local Player = script.Parent.Parent.Parent --remove or add Parents depending where your script it
mine was in StarterGui.Child.Child.Script
so script.Parent.Parent.Parent the third .Parent made it go to StarterGui.
one more .Parent would be the Player
try this
function onPlayerEntered(Player) local PlayerGui = Player:WaitForChild('PlayerGui') local Commands = {} function Commands.FadeShop() local FadeFrame = Instance.new('Frame',PlayerGui) FadeFrame.Size = UDim2.new(0,10,0,10) for i = 1,0,-.1 do wait(.1) FadeFrame.BackgroundTransparency = i end end return Commands game.Players.ChildAdded:connect(onPlayerEntered)
--all you have to do is make it a local script and put game.Players.LocalPlayer