Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't my tool activate?

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.

3 comments

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!

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.

0

...do bumps work?

1 answer

it shouldnt be Activated try using OnEquipped

2 comments

0

Wouldn't that make it eat the berry once you equip it?

0

yes but then you detect a mouse click to make it do that

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