If there is anything wrong with anything from these codes pls correct. Buy Desert Script local UnlockButton = script.Parent.SurfaceGui.UnlockButton local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvents = ReplicatedStorage.RemoteEvents local DesertDoorBought = RemoteEvents.DesertDoorBought
UnlockButton.MouseButton1Click:Connect(function() --Fires when you click the Unlock button wait(0.1) DesertDoorBought:FireServer() end) DesertDoorBought.FireServer:Connect(function() end)

Remote Event --- DesertDoorBought

local plrs = game.Players:GetChildren() local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvents = ReplicatedStorage.RemoteEvents local DesertDoorBought = RemoteEvents.DesertDoorBought local CurrentValue = plrs.PlayerStats.CurrentValue DesertDoorBought.OnServerEvent:Connect(function(Player) local PlainAndDesDivider = game.Workspace.PlainAndDesDivider if CurrentValue >= 200 then PlainAndDesDivider.Transparency = 1 PlainAndDesDivider.CanCollide = false CurrentValue = CurrentValue - 200 else end end)

The error is: ServerScriptService.DesertBuy Handler:6: attempt to index field 'PlayerStats' (a nil value)

1 comment

0

is this a free model.....