Im trying to make a devil fruit eating system but whenever i try to eat it it says Event is not a valid member of LocalScript "Workspace.sanstempapyrus.Ope-Ope.WhenUsed"

Here is the local script:

local tool = script.Parent
local eating = false

tool.Equipped:Connect(function()
	tool.Activated:Connect(function()
		if eating == false then
			eating = true
			script.Event:FireServer("Eat")
		end
	end)
end)

And this is the script inside the local script:

script.Parent.Event.OnServerEvent:Connect(function(Player, Value)
	if Value == "Eat" then
		local tool = script.Parent.Parent
		
		print("eating")
		
	end
	
end)

1 comment

1

Try using script:WaitForChild("Event"):FireServer("Eat"). Also, put the tool.Activated stuff outside of the tool.Equipped stuff, otherwise it will create multiple tool.Activated events every time a player equips the tool, which can cause lag.