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

Why won't this Server script change the value?

Asked by 5 years ago

There are no errors shown and i don't have any idea how to fix this script. Everything is where should it be, so it's not because of the objects.

local RepStorage = game:GetService("ReplicatedStorage")
local Remote = RepStorage:WaitForChild("Remote")
local LocalRemote = Remote:WaitForChild("GunSeller")

LocalRemote.OnServerEvent:connect(function(player, gunvalue, price)

    local gun = RepStorage.Data_Stores.SavedGuns:FindFirstChild(player.Name):WaitForChild(gunvalue).Value
    local givemoney = RepStorage.Data_Stores.Currency:FindFirstChild(player.Name):WaitForChild("Money").Value

    gun = gun - 1 -- Doesn't Change
    givemoney = givemoney + price -- Doesn't Change


end)
0
connect is deprecated use Connect green271 635 — 5y
0
There is no diference. AlphaGamer150 101 — 5y
0
The difference is their state. connect is deprecated whilst Connect is not. User#19524 175 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

This maybe the correct answer, not sure.

when making Locals, don't use .Value, .Name, etc.. Remove the .Value in line 8 after :WaitForChild("Money") and then add it to line 11 which should be givemoney.Value = givemoney.Value + price, the same thing with gun.

0
Thanks for the awnser! It worked fine! Lamantinel -1 — 5y
0
No problemmo mixgingengerina10 223 — 5y
Ad

Answer this question