Cliently shows tools

So earlier today I was scripting a tool buying system. The thing is everything works but the tool shows up cliently. I tried it in a regular script and it didn’t work then I tried it in a local script and it worked but, it shows cliently.

The script is right here.

local player = game.Players.LocalPlayer

local money = player.Data.Wallet.Value

------------//

local item1 = script.Parent.Item1

local item2 = script.Parent.Item2

local item2 = script.Parent.Item3

----------//

function ching()

script.Parent.ching:Play()

end


item1.Purchase.MouseButton1Down:connect(function()

if player.Data.Wallet.Value >= 25 then

player.Data.Wallet.Value = player.Data.Wallet.Value - 25

ching()

local ItemClone = game.ReplicatedStorage.ToolAssets.Other_Tools[“Brief-Case”]:Clone()

ItemClone.Parent = player.Backpack

end

end)


item2.Purchase.MouseButton1Down:connect(function()

if player.Data.Wallet.Value >= 40 then

player.Data.Wallet.Value = player.Data.Wallet.Value - 40

ching()

local ItemClone = game.ReplicatedStorage.ToolAssets.Other_Tools[“DuffleBag”]:Clone()

ItemClone.Parent = player.Backpack

end

end)


item2.Purchase.MouseButton1Down:connect(function()

if player.Data.Wallet.Value >= 5 then

player.Data.Wallet.Value = player.Data.Wallet.Value - 5

ching()

local ItemClone = game.ReplicatedStorage.ToolAssets.Other_Tools[“Glasses”]:Clone()

ItemClone.Parent = player.Backpack

end

end)


First of all, the game.Players.Localplayer will only work on Localscript thats why you are getting an error,

You can use this RemoteEvent to perfectly use the client to server communication.

Also tip:
if you want to make a program like this, you must not do it in localscript because “exploiters” can easily see the script and abuse it.