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

Problem with change intvalue/numbervalue?

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

1 answer

✓ Accepted answer

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

10 comments

0

@theking66hayday it did not work the value is not changing

0

could it be "screen gui" and or "textbutton" in line 5 of the first script

0

Try making a ScreenGui and put a TextButton in the ScreenGui and put a local script in The TextButton

0

If that doesn't work I will save it as a model and send it to u

0

please send me the model

0

ok

0

I updated my post

0

it only works in a new world so ima mess with my gui becuase i have many screen gui's :facepalm:

0

YESSSSSSSSSSSS I GOT IT TO WORK THANK YOU FOR THE HELP (I will mark as answer)

0

No problem happy to help

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