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

how do i script a button to give a player a weapon?

how do i script a button to give a player a weapon? i started with this,

function.onClicked ()

give.Player.Item:35702550 onClicked

end

im very new to scripting (i started 3 hours ago) Please help

1 answer

Put a ClickDetector into the part you want to be clicked. put the weapon you want to give into the ServerStorage

Part = script.Parent -- defines the part

Part.ClickDetector.MouseClick:connect(function(Clicker) -- start event when part is clicked
	local HasWeapon = Clicker.Backpack:FindFirstChild('WeaponName') -- looks for already existing weapon
	if not HasWeapon then -- prevents from getting more than one
	local Clone = game.ServerStorage.WeaponName:Clone() -- duplicates the weapon
	Clone.Parent = Clicker.Backpack -- puts weapon into player's backpack
	end
end)

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