i have a value in workspace which is game.Workspace.Backpack.Capacity.Value i want this value to be different from player to player like if a player have 20 capacity only he have it this is my script which i tried but it changes the value for whole server

local buyItems = game.ReplicatedStorage.B1

buyItems.OnServerEvent:Connect(function(player, B1price)
	if player.leaderstats.Money.Value >= B1price then
		player.leaderstats.Money.Value = player.leaderstats.Money.Value - B1price
		
		game.Workspace.Backpack.Capacity.Value = 20
	end
end)

i dont know where i am going wrong please help me. ThankYou

5 comments

0

Well yeah, you're changing something on the server then expecting it to only change it for one Player? You'd have to do it on the client for that to work and that'd bring it's own set of problems.

1

Changing it for one user would rise several issues, simply just have one Value in each player and modify it that way.

0

You are calling for onserverevent which applies for the server, not the client. I'd just follow the advice on the comment oef by @Feahren

0

so can guys tell me what to do exactly

0

also i have tried fearhan advice but server dosent notice it and it does not work