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

WHy does it say event is not a valid member of LocalScript when i use my devil fruit eating system?

Asked by 2 years ago
Edited 2 years ago

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
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. SpiritualSonicdash 67 — 2y

Answer this question