Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

EquipTool troubles, help?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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!

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. creatorstorm 8 — 9y
0
that should be available if its a tool lacikaturai 89 — 9y
0
Dude look up "EquipTool" in the wiki ·_· creatorstorm 8 — 9y
Ad

Answer this question