Script for something like Restaurant Tycoon?

So, I want to create something that lets me give an item (a tool) to an NPC and then it will react and do some sort of animation. For example in Restaurant Tycoon, when you give an NPC food, a GUI will appear above its head like it’s saying something and do an eating animation. I’m wondering how I achieve a script like that?
If it is too intricate to go that kind of code, I can possibly invest in a scripter. But I would need to save up a lot of rblx currency. Any insight is greatly appreciated ! (I’m a noob to scripting but I really want this in my game!)

4 Likes

Here is a basic example:

local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
local Anim = script.Animation
Anim.AnimationId = "rbxassetid://" -- Animation id
local AnimationTrack = humanoid:LoadAnimation(Anim)

script.Parent.Touched:Connect(function(hit) -- Script in the npcs torso or where ever you want it to be
	if hit.Parent:FindFirstChild("FoodTool") then -- Finds the tool
		hit.Parent:FindFirstChild("FoodTool"):Destroy() -- Takes away the tool from the player
		print("Playing animation")
		wait(1)
		AnimationTrack:Play() -- Plays the animation
	end
end)

Hoped this worked!

3 Likes