You can write your topic however you want, but you need to answer these questions:
-
I want the script to run when its enabled in game.
-
The script shows that it gets enabled but it doesnt actually run.
-
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.ClickDetector.MouseClick:Connect(function()
script.Parent.HP.Value += 1
if script.Parent.HP.Value == max.Value then
script.Parent:Destroy()
end
end)
Equipped Script:
script.Parent.Equipped:Connect(function()
game.Workspace.Crop.HPScript.Disabled = false
end)
script.Parent.Unequipped:Connect(function()
game.Workspace.Crop.HPScript.Disabled = true
end)```
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.