Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with change intvalue/numbervalue?

Asked by 2 years ago
Edited 2 years ago

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

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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

0
@theking66hayday it did not work the value is not changing betme778 6 — 2y
0
could it be "screen gui" and or "textbutton" in line 5 of the first script betme778 6 — 2y
0
Try making a ScreenGui and put a TextButton in the ScreenGui and put a local script in The TextButton theking66hayday 841 — 2y
0
If that doesn't work I will save it as a model and send it to u theking66hayday 841 — 2y
View all comments (6 more)
0
please send me the model betme778 6 — 2y
0
ok theking66hayday 841 — 2y
0
I updated my post theking66hayday 841 — 2y
0
it only works in a new world so ima mess with my gui becuase i have many screen gui's :facepalm: betme778 6 — 2y
0
YESSSSSSSSSSSS I GOT IT TO WORK THANK YOU FOR THE HELP (I will mark as answer) betme778 6 — 2y
0
No problem happy to help theking66hayday 841 — 2y
Ad

Answer this question