So I was making a tool giver and the script runs and gives the tool when the part is clicked. But then I wondered if I could give the tool to someone if the touched the block, instead of clicking it. Since im a very small developer and probably not very smart compared to all of you great developers out there, this might be a easy fix to you all. Please answer as soon as possible. Thank you!
2 Likes
Have you tried something yet? (if so, could you send us your code to see what does not work and what does work?) Or do you want us to teach you how to do it?
I only know how to give a tool when using a ClickDetector. But I want to know how to give a tool to someone when they touch the block. I don’t have any code to show, because I have no idea how to do it.
local RS = game:GetService("ReplicatedStorage")
local Tool = RS:FindFirstChild("TOOLNAME")
local Debounce = true
script.Parent.Touched:Connect(function(Hit)
local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
if Player and Debounce == true then
Debounce = false
Tool:Clone().Parent = Player:WaitForChild("Backpack")
wait(1)
Debounce = true
end
end)
14 Likes