local Players = game:GetService("Players")

local goldChunk = script.Parent

local function onPartTouch(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
-- Destroy the pickup
goldChunk:Destroy()
-- Update the player's leaderboard stat
local player = Players:GetPlayerFromCharacter(partParent)
local leaderstats = player.leaderstats
local goldStat = leaderstats and leaderstats:FindFirstChild("Gold")
if goldStat then
goldStat.Value = goldStat.Value + 10
end
end
end
goldChunk.Touched:Connect(onPartTouch)

I have such a script from the Internet and it works. It can be inserted into any Part and works when you touch it. I tried to turn it into a bullet to gain experience with the damage done. But it didn't work out. Who can help out?


It's written in the weapon!!! I wrote this, when a zombie takes damage, the local player receives experience and money, however, this experience and money are not saved. Maybe you can fix it somehow to make it work?

			local plr = game:GetService("Players").LocalPlayer
			local exp = plr.leaderstats:WaitForChild("EXP")
			local mon = plr.leaderstats:WaitForChild("Money")
			local lvl = plr.leaderstats:WaitForChild("Level")
			local plusexp = game.Lighting.stats.EXP
			local plusmon = game.Lighting.stats.Money
			mon.Value = mon.Value*plusmon.Value+(math.random(1,3))
			exp.Value = exp.Value*plusexp.Value+(math.random(1,3))