Hi. So i made a sell script in serverscriptservice and its not working. any idea why?
game.ReplicatedStorage.SellEvent.OnServerEvent:Connect(function(player)
local leaderstats = player.leaderstats
local RoCoin = leaderstats["Ro-Coin"]
local RoBucks = leaderstats.RoBucks
local Value = leaderstats.RoValue
RoBucks.Value = RoBucks.Value + RoCoin.Value * Value.Value
RoCoin.Value = 0
end)
-- above shouldnt be interfereing, the below one is the problem
game.ReplicatedStorage.SellEventDesert.OnServerEvent:Connect(function(player)
local leaderstats = player.leaderstats
local RoCoin = leaderstats["Ro-Coin"]
local RoBucks = leaderstats.RoBucks
local Value = leaderstats.RoValue
local selVal = Value *2
RoBucks.Value = RoBucks.Value + RoCoin.Value * Value.Value
RoCoin.Value = 0
end)

2 comments
RoValue is a instance, RoValue.Value is a number. you can't do (object) * 2.
arthmetic is math