Hi, I've been trying to get this script working for ages but I can't seem to even though the task that I'm trying to achieve seems very simple. So I have a TextButton in StarterGui and when it's clicked it changes a NumberValue, which is stored in the workspace. It is successfully changing the value of the number value in the workspace but in my scripting, it isn't working. I'm sure I've written the script wrong so any advice would help me a lot.
Here is my script:
-- PlowedDirt is the name of a part that I'm storing in ServerStorage
game.Workspace.Value.Changed:connect(function(NewValue) Value2 = NewValue.Value end) local value = 0 local function clicked(player) if value == 0 and Value2 == 1 then local replacement = game.ServerStorage.PlowedDirt:Clone() replacement.Parent = script.Parent replacement.Position = script.Parent.Position + Vector3.new(0,0.1,0) value = 1 end end script.Parent.ClickDetector.MouseClick:Connect(clicked)