Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make a gamepass give someone a weapon or weapons if they have it?

Asked by 10 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

This is useful for like minigames and stuff! So if you know how please help me.

2 answers

Log in to vote
0
Answered by 10 years ago

Hello if you want to do that make a model and insert a script and type ~~~~~~~~~~~~~~~~~

local function WaitForChild(parent, childName) assert(parent, "ERROR: WaitForChild: parent is nil") while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end


--| Variables |--

local GamePassService = Game:GetService('GamePassService') local PlayersService = Game:GetService('Players') local LightingService = Game:GetService('Lighting') --TODO: Use new data store service once that exists

local GamePassIdObject = WaitForChild(script, 'GamePassId') local AdminTools = WaitForChild(LightingService, 'Gamepack1')


--| Functions |--

-- Makes copies of all the admin tools and puts them in target local function CloneAdminTools(target) for _, tool in pairs(AdminTools:GetChildren()) do local toolClone = tool:Clone() toolClone.Parent = target end end

-- When a player with the game pass joins, give them the admin tools local function OnPlayerAdded(player) if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then local starterGear = WaitForChild(player, 'StarterGear') CloneAdminTools(starterGear) if player.Character then -- They've already loaded and won't get their StarterGear until next spawn local backpack = WaitForChild(player, 'Backpack') CloneAdminTools(backpack) end end end


--| Script Logic |--

PlayersService.PlayerAdded:connect(OnPlayerAdded)

~~~~~~~~~~~~~~~~~ once you have this insert a IntValue and rename it to GamePassId and change the value to the game pass id then add a model into the model and name it Gamepack1 and put the weapons in the model called Gamepack1.

Ad
Log in to vote
-1
Answered by
oGxbe 0
10 years ago

Just make a script for it like Devoleper script. But you'd have to keep track. But if you want it for gamepass in game or something like that take this. http://www.roblox.com/Custom-Weapons-Game-Pass-item?id=95614201 and if you want to add something from your computer into it or just add something to it use this http://www.roblox.com/Advanced-Midi-Player-8-5-NEWEST-item?id=81001990

Answer this question