I have trouble with this. When something is on the floor or ground like a Gun or flashlight, it will print "Press E to pick up GunName" or "Press E to pick up Flashlight". then when you pick it up, you have it. How'd I do that?
1. Put the following code into a LocalScript
and insert it into StarterPack.
2. Put the tools into a model named "Tools" and cut/paste the model into Lighting.
3. Cut/paste the contents of your tools
into models
and rename the models to the exact same name as their corresponding tool.
4. Put the models (that look like they're tools) into workspace and position them.
Steps 2 - 4 make it so players can't pick up tools on the ground by touching them (so we're making fake "tools" that cannot be picked up when touched.)
local tools = {["Flashlight"] = true, ["Pistol"] = true} local radius = 10 local removeToolUponPickUp = true -- true and the tool is removed when picked up, false and it stays local player = game.Players.LocalPlayer local mouse = player:GetMouse() local running = false local found, hint function getTools() local found = {} for _, c in pairs(game.Workspace:GetChildren()) do if tools[c.Name] then table.insert(found, c) end end return found end function walking(speed) running = speed > 0 and true or false while running and not found do for _, tool in pairs(getTools()) do local pos = tool:GetModelCFrame().p if player:DistanceFromCharacter(pos) < radius then found = true hint = Instance.new("Hint", player.Character) hint.Text = "Press E to pick up "..tool.Name found = tool while true do if player:DistanceFromCharacter(pos) > radius then hint:Destroy() found = nil break end wait(0.25) end end end wait(0.25) end end mouse.KeyDown:connect(function(key) if key:lower() == "e" and found then local tool = game.Lighting.Tools[found.Name]:Clone() tool.Parent = player.Backpack if removeToolUponPickUp then found:Destroy() if hint then hint:Destroy() end end found = nil end end) repeat wait() until player.Character wait(0.5) player.Character.Humanoid.Running:connect(walking)
If you find any problems let me know, I completed this while managing several other things so it wouldn't surprise me. I have tested it though and to my knowledge it functions properly.
Edit: if you don't understand the steps on how to function this thing you can visit this place (it is uncopylocked.)
Edit2: I added a half second wait after line 59
to ensure the code runs properly when in online mode.
lol I asked that a few days ago...