Roblox Scripting Tutorial: Tool Giver
Today we're going to take a look at how to make an old school tool giver!
Giver Script:
-- This line looks for a tool grouped with the giver button.
local tool = script.Parent.Parent:FindFirstChildOfClass("Tool")
local debounce = false
script.Parent.Touched:connect(function(part)
if not debounce then
debounce = true
-- Checks to see if whatever hit the button has a Humanoid.
if part.Parent:findFirstChild("Humanoid") then
local player = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
-- Checks to see if we were able to get a player from the character.
if player then
-- Copies the tool to the players StarterGear and Backpack
-- NOTE: If you don't want the player to have the weapon every time they
-- respawn, delete the following line.
tool:Clone().Parent = player.StarterGear
tool:Clone().Parent = player.Backpack
end
end
wait(.5)
debounce = false
end
end)
Namer Script:
giver = script.Parent.Parent
tool = giver:FindFirstChildOfClass("Tool")
giver.Name = tool.Name.. " Giver"
Be sure to follow me on Twitter after rating, commenting, and subscribing!
https://twitter.com/Rrrrry123
Also, follow me on Twitch for some live streams!
http://www.twitch.tv/Rrrrry123
Other Videos By RyGuyGaming
Other Statistics
Roblox Statistics For RyGuyGaming
At present, RyGuyGaming has 459,946 views spread across 106 videos for Roblox, and roughly a days worth of Roblox videos were uploaded to his channel. This makes up 17.76% of the content that RyGuyGaming has uploaded to YouTube.