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

How do I ensure the player always has something in their inventory equipped?

If you don't understand what I am asking, you should play Blood & Iron, in which the player always has something in their hand. I made a script here that forces the equip function, but it equips everything in the player's inventory, which I don't want. It also removes the unequip function.Here's the script:

game:GetService("Players").PlayerAdded:connect(function(player)
	local function hookTool(Tool)
		if not Tool:IsA("Tool") then return end
		game:GetService("RunService").Heartbeat:wait()
		Tool.Parent = player.Character
	end
	
	player:WaitForChild("Backpack").ChildAdded:connect(hookTool)
	
	player.ChildAdded:connect(function(child)
		if child:IsA("Backpack") then
			child.ChildAdded:connect(hookTool)
		end
	end)
	
	end
)

1 comment

0

My best bet is welding the tools model to the players hand, from there reprogram the mouse, like you would normally do if the tool was equipped. My best bet at least.

1 answer

I would suggest using

if tool.Activated then -- finish the line of code

3 comments

0

where would I implement this in the script?

0

on line 11

0

Thanks, I'll test it

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