This is the script for the ClickDetector that gives the player a tool. This is not related to the thing I’m achieving, and not the ClickDetector that I want it to have ClickDetector Hover.
local ToolNames = {"Battery"}
local Storage = game:GetService("ServerStorage")
local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")
ClickDetector.MouseClick:connect(function(Player)
local model = game.Workspace.Battery
script.Parent.Script.Disabled = true
script.Parent.ClickDetector.MaxActivationDistance = 0
if Player and Player.Character then
local Backpack = Player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
Tool:clone().Parent = Backpack
for i, model in ipairs(model:GetDescendants()) do
if model:IsA("BasePart") then
model.Transparency = 1
end
end
end
end
end
end)