How can I use ProximityPrompts to add leaderstat.Points.Value?

I usually get around problems but in this case, I would want to know how to use ProximityPromts to be able to achieve and add leaderstat.Points.Value.

How can I connect:

local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:connect(function(Player)

to

local player = game.Players:GetPlayerFromCharacter(?.Parent)

player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1000

I tried replacing the “?” with Player to connect the function but it still didn’t work.

4 Likes

I don’t think you need to use GetPlayerFromCharacter.
Try doing:

ProximityPrompt.Triggered:Connect(function(player)
player.leaderstats.Points.Value += 1000
end)
3 Likes

Thank you I think the script you have given me is truthful, however, I want to ask about this:
c
Usually they never ask me that since I have 2 other point systems. But why didn’t it change. I replaced everything with player.leaderstats.Points.Value to player.leaderstats.clean.Value

Can I please see your leaderstats script?

1 Like

I just realized instead of adding it as clean I wrote it off as clea. I do apologize for being a burden to your time. Thank you for your help and support.

function onPlayerEntered(newPlayer)
	wait(.5)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"

	local score = Instance.new("IntValue")
	
	score.Name = "clean"
	score.Value = 0

	score.Parent = stats	
	stats.Parent = newPlayer
end

game.Players.ChildAdded:connect(onPlayerEntered)

No, it’s completely fine!
Just 1 more question; is there a reason “leaderstats” is an IntValue instead of a Folder?

1 Like

I am more familiar with using IntValue more than a Folder. Why are you asking that?

Oh, I usually use a Folder, and most of the tutorials also use a Folder.
I was just a bit confused, sorry :sweat_smile:

1 Like

Thank you, I’ve been trying to make smth work like this and you were just the solution!

2 Likes