There seems to be a "argument 1 missing or nil on line 8" please may someone point it out :P
goku
local id = 3352345245 -- not the real id :P local part = script.Parent script.Parent.Touched:Connect(function(pepe) if game.Players:GetPlayerFromCharacter(pepe.Parent) then local player = game.Players.LocalPlayer if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player,id) then part.CanCollide = false wait(0.5) part.CanCollide = true end end end)
A Server Script (Script) is, implied by it's name, run on the Server. When FilteringEnabled
is on (which it is 24/7 now), the Server is restricted in some natures. An example of this is the server's access to LocalPlayer
.
When used in a server script, LocalPlayer
will always return nil. This is why you are erroring, but fear not. We can use the Hit
parameter of the Touched
event to get the player!
UserOwnsGamePassAsync
takes a player's userid, not the player themselves.
local id = 3352345245 -- not the real id :P local part = script.Parent script.Parent.Touched:Connect(function(pepe) if game.Players:GetPlayerFromCharacter(pepe.Parent) then local player = game.Players:GetPlayerFromCharacter(pepe.Parent) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then part.CanCollide = false wait(0.5) part.CanCollide = true end end end)