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

Why won't my tool activate?

Asked by 8 years ago

I'm trying to make a berry that when you eat it, gives the person who ate it 45 Mana. However, the script in my tool will not recognize when it activates/the tool isnt activating at all! Also, there's no output errors. Can someone help me? Code:

local Tool = script.Parent
local player = game.Players.LocalPlayer
mouse = game.Players.LocalPlayer:GetMouse()
nomore = false
function onActivated()
    print("activated")
if nomore == false then
    print("eating berry")
    nomore =true
    script.EatSound:Play()
Tool.GripForward = Vector3.new(0,0,-1)
    Tool.GripPos = Vector3.new(1.392,-0.663,-0693)
    Tool.GripRight = Vector3.new(1,0,0)
    Tool.GripUp = Vector3.new(0,1,0)
    wait(2)
    print("Mana Up!")
    pxp = player.leaderstats.Mana.Value
    player.leaderstats.Mana.Value = pxp + 45
    script.Parent:Destroy()
end
end
Tool.Activated:connect(onActivated)  -- Doesn't work at all?! WHAT?!

--Keep in mind this is in a LocalScript.. Regular scripts couldn't even work.
0
I am confused as to what you are trying to make this script do I mean are you trying to make it so when the player left clicks this function runs or something? If so I can help you however tell me what you're trying to do please! KingLoneCat 2642 — 8y
0
When the player left-clicks, it disables doing the thing again (so they dont spam mana) puts the berry at their mouth, then it adds 45 mana and deletes the tool. NobleReign 36 — 8y
0
...do bumps work? NobleReign 36 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

it shouldnt be Activated try using OnEquipped

0
Wouldn't that make it eat the berry once you equip it? NobleReign 36 — 8y
0
yes but then you detect a mouse click to make it do that Thegrimdeathzombie 40 — 8y
Ad

Answer this question