Forja

Roblox tool giver script

Touch a part to get a tool, such as a sword or a flashlight. Players only get one.

Where it goes

  1. 1Put your Tool in ServerStorage, and put its exact name in TOOL_NAME.
  2. 2Add a Part for players to touch and turn on Anchored. Hover over it in the Explorer, press + and choose Script.
  3. 3Delete what's in the Script, paste this in and press Play.
ToolGiver · a Script in the Part players touch
-- From forja.us/tools/roblox-scripts/tool-giver-- Touch this part to get the tool, if you don't have it already.local Players = game:GetService("Players")local ServerStorage = game:GetService("ServerStorage")local TOOL_NAME = "Sword"local part = script.Parentpart.Touched:Connect(function(hit)	local character = hit:FindFirstAncestorOfClass("Model")	local player = character and Players:GetPlayerFromCharacter(character)	local backpack = player and player:FindFirstChildOfClass("Backpack")	if not backpack then		return	end	if backpack:FindFirstChild(TOOL_NAME) or character:FindFirstChild(TOOL_NAME) then		return	end	local tool = ServerStorage:FindFirstChild(TOOL_NAME)	if tool then		tool:Clone().Parent = backpack	else		warn("No tool named " .. TOOL_NAME .. " in ServerStorage")	endend)

How it works

  • ServerStorage keeps the original out of the game. Each player gets a Clone of it.
  • A tool sits in the Backpack, and in the character while it's being held, so both are checked before giving another.
  • Tools in the Backpack are lost when a player dies. To keep them, also clone into player.StarterGear.

Make it yours

Buy it with coins
Before cloning, check the player's Coins and take the price off.
Want something more? The script generator can write it: “A shop part that gives a sword for 100 coins, and tells the player if they can't afford it”

Maps to try it on: arena and combat maps

Start from a finished map, and your scripts have a game to run in.

More free Roblox scripts