I’m wondering how to make givers for my games, can somebody give me the script?
for tools:
local Tool = script.Parent:FindFirstChildOfClass("Tool")
function Give(player)
local backpack = player:FindFirstChildOfClass("Backpack")
if backpack then
Tool.Parent = backpack
end
end
script.Parent.ClickDetector.MouseClick:Connect(Give)
About the Scripting Support category: Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
I understand you needing some help on certain things once you’ve already got stuff started, but earlier you asked about how to make a chat system like Arsenal without anything made yet either.
Albeit I’ll still attempt to help you with this one, but for future reference try to search things up on the DevForum first before just creating a new post that has probably already been made before.
This would be a server script parented to a Part
. When you touch the part
, it will give you the tool.
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local part = script.Parent
local toolName = "Tool Name Here"
local tool = ServerStorage:WaitForChild(toolName)
local CAN_GET_MULTIPLE = false -- set to true if you want to be able to get the tool multiple times
local function hasTool(player: Player, nameOfTool: string)
if player.Backpack:FindFirstChild(nameOfTool) == nil and player.Character:FindFirstChild(nameOfTool) == nil then
return true
end
return false
end
local function onTouch(hit: BasePart)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health > 0 then
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player and (CAN_GET_MULTIPLE and (not hasTool(player, toolName)) then
tool:Clone().Parent = player.Backpack
end
end
end
part.Touched:Connect(onTouch)
And here’s some related posts I found (may not have the exact solution, but blatantly giving out answers doesn’t really help anyone learn). You can pull ideas from these posts to try and solve it from scratch to help learn the topics if you’d like:
Universal random giver (Forummer’s response)
Script to give player a tool (2kvigilanxe’s response)
ok thank you, I will search things up in future reference, thanks for reminding me, I just got levelled up today to Member and got a bit carried away with posts.