I am trying to make it where when you click on a text button a value changes but I can't get it to work. here is the code
under the text button:
local button = script.Parent function changevalue() game.Workspace.spawnrate.Value = 2 end button.mouseMouseButton1Click:Connect(changevalue)
I have tried int values and number values
the value is under workspace
PLEASE help
Hi, I fixed it this is how I did it. Add a folder in Workspace and name it ADD then insert your numbervalue. Make sure you rename it to VValue. Then add a remoteevent to replicatedstorage and rename the remoteevent to Value. In starter gui add a local script in your button. Local script code:
local p = game.Players.LocalPlayer p.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("TextButton").MouseButton1Click:Connect(function() game.ReplicatedStorage.Value:FireServer() end)
Then add a script to serverscriptservice
game.ReplicatedStorage.Value.OnServerEvent:Connect(function(p) script.Parent.Parent.Workspace.ADD.VValue.Value = 2 end)
Hope this helps!! I tested it already and it works!! Model