Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

EquipTool troubles, help?

So I'm working on an FPS game and I wanted the FIRST weapon in backpack equipped as soon as the player hits the "Play" button in the main GUI,unfortunately I do not know how.

Here's my attempt anyways : (LocalScript Inside the "Play" button)

 player = game.Players.LocalPlayer
function onClick()
   player.Character.Humanoid:EquipTool(player.Backpack.ToolName) --Asking for specific tool
end

script.Parent.MouseButton1Down:connect(onClick)

As you see in line "3" I'm asking for a specific tool name, But I want the first Tool in the Backpack to be equipped any solutions/ideas?

Help will be appreciated! :D

1 answer

Try putting the tool in ReplicatedFirst and leave any scripts in it enabled and you should use the MouseButton1Click event of a text button Random Example:

local Tool = game.ReplicatedFirst.Gun

script.Parent.MouseButton1Click:connect(function() local ToolClone = Tool.Clone() ToolClone.Parent = game:GetService("Players").LocalPlayer.BackPack end)

This was typed as if the script was in the text button or the play button hope this helped a bit!

3 comments

0

Not what I wanted, the tool is already cloned when "PLAY" is hit,I just wanted the player to take it out/equip it.

0

that should be available if its a tool

0

Dude look up "EquipTool" in the wiki ·_·

This discussion is preserved as it was. New answers, comments, and votes are closed.