Hello, I'm trying to make a tool that gives the player a Roblox gear when it's clicked using InsertService, but it has to be in a server script for that to work. Does the script have to be a localscript for getting the player's mouse?
Also, the tool works fine in Studio, but in-game it prints "Equipped" and "Found player" and then nothing else.
Here's the script (serverscript)
gears = {170896461, 257810065, 365674685, 319656339} local Tool = script.Parent Tool.Equipped:connect(function(Mouse) print("equipped!") local ply = game.Players:GetPlayerFromCharacter(script.Parent.Parent) print("found player!") Mouse.Button1Down:connect(function() print("mouse down!") wait(1) local model = game:GetService("InsertService"):LoadAsset(gears[math.random(#gears)]) for _,v in pairs(model:GetChildren()) do if v:IsA("Tool") or v:IsA("HopperBin") then v.Parent = ply.Backpack print("got model!") script.Parent:Destroy() end end end) end)