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

Why won't this Server script change the value?

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)

3 comments

0

connect is deprecated use Connect

0

There is no diference.

0

The difference is their state. connect is deprecated whilst Connect is not.

1 answer

✓ Accepted answer

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.

2 comments

0

Thanks for the awnser! It worked fine!

0

No problemmo

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