Enabling scripts in game not working? Help!

You can write your topic however you want, but you need to answer these questions:

  1. I want the script to run when its enabled in game.

  2. The script shows that it gets enabled but it doesnt actually run.

  3. I tried looking on google for help but nothing comes up with my issue.

So basically i want to make a crop, when a particular tool is equipped, the script is enabled and it allows the crop to be farmed, but if the tool isnt equipped the script is disabled and the crop cannot be farmed. But in the hierarchy it shows that the script gets enabled and disabled when it should but the issue it that the script doesn’t actually run or do anything. I’ve made sure it wasn’t my fault by leaving the script enabled and testing it. It seems that once the script remains enabled when the game starts and the disabled value isnt changed at all it works. But as soon as its chnaged…doesnt work at all.
(Both are server scripts)

Crop Script

local max = script.Parent.MaxHP

	script.Parent.HP.Value += 1
	if script.Parent.HP.Value == max.Value then

Equipped Script:

	game.Workspace.Crop.HPScript.Disabled = false

	game.Workspace.Crop.HPScript.Disabled = true

Please do not ask people to write entire scripts or design entire systems for you. If you can't answer the three questions above, you should probably pick a different category.
1 Like

Is this a localScript or a Script?
Also tried using

  • Tool.Equipped:Connect(function(mouse) mouse.Button1Down:connect(function() local target = mouse.Target if target then
    –code here
    end end) end)

Both server scripts one inside the tool and other inside the crop in workspace

But how would i reference the tool…its in starterpack. Because i already tried referencing it from the backpack and it didnt work

It may not always be in the backpack, try:


The tools are automatically placed inside of the character when the player equips a tool.

Make the Crop script inside workspace a ModuleScript and use local module = require(Target.ModuleScript)

module:Print(“You’ve been cropped”)

module = {}
function module:Print(abc)

return module

basic module script