local id = 5010007 local Script = game.ServerScriptService.GamePassDoubleJump local LScript = game.ServerScriptService.GamePassDoubleJump.DoubleJump local scriptclone = LScript:clone() game.Players.PlayerAdded:connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then scriptclone.Parent = game.Players.LocalPlayer.PlayerScripts end end)
im confused, it only works in studio.
Error: ServerScriptService.GamePassDoubleJump:7:attempt to index field 'LocalPlayer" (a nil value)
DataModel
and the Players
service) of a LocalScript
is, well, the LocalPlayer
. Script
s run on the server, whilst LocalScript
s run on the client.LocalScript
is your LocalScript
, it works for you. But your classroom is your classroom, and in it are your classmates as well as your teacher. Think of the classroom as the server. It has everyone in it, and cannot keep track of who in the heck LocalPlayer
is! For this reason, LocalPlayer
is nil on the server. Code cannot your mind. This is why it must be all typed out. So instead of doing this:make a part inside of the workspace with color red
local part = Instance.new("Part") part.BrickColor = BrickColor.new("Really red") part.Parent = workspace