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 make a model able to interact with the player?

For example, using a model as ingredients to make something else (another model). Let's say I have a model of chips, cheese, and salsa and when I put them together with a plate, I get nachos. How do I do that?

1 answer

Requesting isn't allowed on this site. At least try to have made the script yourself.

Well, not sure if you want it in values, variables, objects, or whatsoever. If you're making a crafting system or something like that you got to get a GUI, buttons, and stuff.

This is a basic representation using a certain key button on your keyboard to create the item. Let's just say you have ObjectValues of the items you want into your player in game.Players, then you set the name of the ObjectValues (chips, cheese, salsa) and then you would press the button to craft them all into your desired nachos.

certainkey = "e" -- the certain key button you want to be pressed in order to run the script, make sure it's in quote marks. In this case, the certain key to be pressed is the letter E.
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
mouse.KeyDown:connect(function(k)
	local key = k:lower()
	if key == certainkey then
		chips = plr:FindFirstChild("Chips")
		cheese = plr:FindFirstChild("Cheese")
		salsa = plr:FindFirstChild("Salsa")
		if chips and cheese and salsa then
			chips:Destroy()
			cheese:Destroy() -- poof, there goes your chips, cheese, and salsa!
			salsa:Destroy()
			local instance = Instance.new("ObjectValue", player) -- creates a new objectvalue into your player!
			instance.Name = "Nachos" -- hello nachos, goodbye chips, cheese, and salsa!
		end
	end
end)

This is only a basic representation so you should learn from it, you don't even have a system for your food crafting, models, nor such. I could make such a whole system for you in multiple scripts but you should learn rather than be lazy.

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