Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Problem with my script?

It's not working, may someone help me fix it?

local gear = Game.Lighting.flag 

local GamePassId = 163409880  -- This is the right gamepass id 

Game.Players.PlayerAdded:connect(function(Player) 
Player.CharacterAdded:connect(function() 
	if Player.StarterGear.flag ~= true then
		local gearClone = gear:clone()
		gearClone.Parent = Player.StarterGear
		wait(0.1)
		local gearClone2 = gear:clone()
		gearClone2.Parent = Player.Backpack
		
		print("Success")

end
end)
end)

1 answer

✓ Accepted answer
local gear = game.Lighting.flag --Lua is case sensitive, it's game not Game.

local GamePassId = 163409880  -- This is the right gamepass id 

game.Players.PlayerAdded:connect(function(Player) --Lua is case sensitive, it's game not Game.
Player.CharacterAdded:connect(function() 
if game:GetService("MarketplaceService"):PlayerOwnsAsset(Player ,GamePassId) then --You wanted the script to be a VIP script right?
  local gearClone = gear:clone()
        gearClone.Parent = Player.Backpack --StarterGear is not a member of Player, Backpack is though.
        wait(0.1)
        local gearClone2 = gear:clone() --Why give them two?
        gearClone2.Parent = Player.Backpack

        print("Success")
end
end)
end)

The script will only work in online mode, if you experience errors there, then press F9 and tell us the output (red part with some blue lines explaining the problem).


I don't see why a admin has noted this answer, I did give explanation why the code was not working as intended, and that was because Starterpack is not in Player.

2 comments

0

Edited, you shouldn't need that line to tell if you have the flag in your inventory or not, since you respawned with a new set of tools.

0

Thank you very much!

This discussion is preserved as it was. New answers, comments, and votes are closed.