How do I make a IntValue in leaderstats change when it is touched by a player

I am kind of new to scripting and need help with this. I can’t figure out how to make a IntValue in leaderstats change when a player touches it.

can you specify on touching what should the int value change ?

I want to change the value on the IntValue

umm I meant when should the int value change ?
like on touching block or something.

Oh it just changes instantly but I also need to know how to make it wait before adding the value again

well if I got it right, here’s the code.

game.Players.PlayerAdded:Connect(function(fv1)"Folder", fv1).Name = "leaderstats""IntValue", fv1.leaderstats).Name = "Int"
fv1.leaderstats.Int.Value = 100 --change "100" to what you want

Do you know where I should put it like in serverscript service or a part. Also should I delete my leaderstats code.

yea delete the leaderstats code and put this in serverscript service.

Theres a ) at the end and it has a red line what do I do?

opps there was an error, fixed it. :slight_smile:

Btw theres no stat anymore so Idk what to do

if should work fine now, check it.

This code is also not what I need. I need a part to change a IntValue in leaderstats. For example if a player touches a part the players IntValue in the leaderstats folder goes up

Oh sorry, I didn’t get it at 1st
here you go

local part = --put the part here
if v1.Parent:FindFirstChild("Humanoid") ~= nil then
game.Players:FindFirstChild(v1.Parent.Name).leaderstats.Int.Value += 100


put the previous script and this script together for it to work

Thx man it worked I appreciate it