How To Make Client-Sided Part That Gives Currency (leaderstats)

Destroying parts on the client won’t replicate, so we can run the same lines of code each time

1 Like

What you mean by that client and server? Client is StarterPlayerScripts - StarterPlayer? And the server is ServerScriptStorage?

client is startercharacterscripts or starterplayerscripts. server is serverscriptstorage. what else would i be referring to?

Do you have discord so we could discuss this? I will just design more maps and skip scripting part

Yes I do, Peter / Quân#9748 is my Discord account

Insert Script inside the ServerScriptService

local Players = game:GetService("Players")

local Part = Path.To.Part.In.Datamodel
local PartTouched_Connection;

PartTouched_Connection = Part.Touched:connect(function(TP)
  local Player = Players:GetPlayerFromCharacter(TP.Parent)

  if Player ~= nil then
    Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1
    PartTouched_Connection:Disconnect()
  end
end)

Script made by @Noble_Draconian