Issues with roblox studio

hello👋
i have issues with roblox studio..

when player buy npc
image

his money be -100

the localscript

the normal script
image

thank you for read :blush:

2 Likes

Are there any errors? Also, you should check how much money the player has on the normal script too.

2 Likes
local Player = game:GetService("Players").LocalPlayer
local npcevent1 = game:GetService("ReplicatedStorage"):WaitForChild("npcevent1")
local npcnotwork = game:GetService("ReplicatedStorage"):WaitForChild("npcnotwork")

local leaderstats = Player:WaitForChild("leaderstats")

script.Parent.MouseButton1Down:Connect(function()
     if leaderstats.lod.coins.Value  >= 125 and Player.lod.npc.Value == false then
         cost.Text = "cost:300"
         npcnumber.Text = "1 npc"
         ownnpc.Text = "your own npc is 1"
         npcevent1:FireServer()
         npcnotwork:FireServer()
     end
end)
local npcevent1 = game:GetService("ReplicatedStorage"):WaitForChild("npcevent1")

npcevent.OnServerEvent:Connect(function(plr)
       local leaderstats = plr:WaitForChild("leaderstats")
       
       leaderstats.lod.npc1.Value = true
       leaderstats.lod.npc.Value = 1
       leaderstats.lod.npc2.Value = false
       leaderstats.lod.coins.Value = leaderstats.lod.coins.Value - 100
end)
1 Like

You just have to check if the player has enough money to buy things in the normal script!
Else, don’t say it’s an issue with roblox studio because YOU made mistake, not roblox studio, plus a pc never get the wrong answer!
Have a good day !

1 Like

The code its ok, add the same verifs if you have on localscript to serverscript

1 Like

there no errors and money system is so good

1 Like

i copy and paste it on another place and its work
i think its from studio

1 Like

thank you for reply

its coins

image

when player buy npc

image

the player lose 1000 + 10

i dont know why player lose 1000

1 Like

thank for any one reply

i fix it

image

should for any one think Out of the box

1 Like

This script may not be the problem.

1 Like