local id = 1324880817 local Player = game.Players.LocalPlayer game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:Connect(function(char) if game:GetService('GamePassService'):PlayerHasPass(plr,id)then Player.StarterGui.RadioGui.Button.Visible = true else Player.StarterGui.RadioGui.Button.Visible = false end end) end)
Error attempt to index upvalue 'Player' (a nil value)
Okay so, for one, you don't need the second line. For two, a player doesn't have a StarterGui in them, they have a PlayerGui
For the differences between PlayerGui's and StarterGui's, click here
The script I'm going to give is for a Server Script. Everything new that will be added will be explained.
local id = 1324880817 local Players = game:GetService("Players") -- Gets the player service Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) local RadioGui = plr.PlayerGui:WaitForChild("RadioGui") --Waits for the gui so there are no errors if RadioGui then --Makes sure that the gui is actually there local Button = RadioGui:WaitForChild("Button") --Waits for the button if Button then --Checks if the button is actually there if game:GetService('GamePassService'):PlayerHasPass(plr,id) then Button.Visible = true else Button.Visible = false end end end end) end)
Hope that this helped, make sure to mark this as resolved if it did!