local sellPart = script.Parent
sellPart.Touched:Connect(function(HIT)
	local H = HIT.Parent:FindFirstChild("Humanoid")
	if H then
		local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
		if player then
			local leaderstats = player:WaitForChild("leaderstats")
			local playerGold = leaderstats.Gold
			local playerMIS = leaderstats.MoneyInStorage

			print(playerMIS.Value)

			playerMIS.Value = playerMIS.Value *1
			if playerMIS.Value > 0 then
				playerGold.Value = playerGold.Value + playerMIS.Value
				playerMIS.Value = 0
			end
		end
	end
end)

It always thinks that playerMIS.Value = 0 but it is actually another number like 10 (>0) in my leaderstat. Any way I can fix that?? Naturally playerMIS.Value increases through LocalScript while this is usual Script, maybe it is a problem?

2 comments

0

its called a local script for a reason

0

If you are increasing through a localscript, the server can't see it. That is because localscript runs only for a client and the script (a server script) won't see it.