I’m trying to make a jetpack in a game i’m trying to make but I only want it so only developers can use the jetpack in game. I’m not really sure on how to do this but would like some on advice on how to make a only developer item.
If you want to restrict an item to be used only by a developer, scripting it requires checking the ID first before usage. If the ID in a valid list, the player will have the jetpack functionality enabled.
It’s not really complicated. Just make a table with the developer(s) userId and when a player enters, loop through the arrays and if met, replicate the jetpack to their backpack.
You can make a table with all your developers User ID’s in, and then check for the player in a server script game.Players.PlayerAdded:Connect(function(player) and if the player User ID matches the table (which you can check for by using table.find) then clone the jetpack from ReplicatedStorage, and put it in there Backpack.
– It would be something like this, (I haven’t tested this code yet)
local YourTable = {UserID,UserID,etc}
local jetpack = game.replicatedstorage.jetpack:Clone()
game.Players.PlayerAdded:Connect(function(player)
if table.find(YourTable, player.UserId) then
jetpack.Parent = player.Backpack
else
-- do nothing
end
end)
local Developers = {09124124,12441242, "NameOfPlayer"} -- Creating a table, etiher enter their Name or UserId, Most people use UserId since players names can be changed.
local Players = game:GetService("Players") -- Similar to game.Players, better to build a habbit of using :GetService()
Players.PlayerAdded:Connect(function(player) -- Basic stuff you should learn, PlayerAdded Event
if table.find(Developers, player.UserId) then -- If you used names then keep it as player
local Jetpack -- Wherever your jetpack is :Clone() it
jetpack.Parent = player.Backpack -- Just parenting the Jetpack to the players Backpack.
end
end)
-- I would highly recommend learning tables, and just the basics first. Hope this helps!