What do you want to achieve? When my character touches “Part100” my points are reset to zero
What is the issue?
It reacts to touches, but it does not reset points
local Part100 = script.Parent
Part100.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local PlayerPoind = hit.leaderstats.Points
PlayerPoind.Value = PlayerPoind.Value - PlayerPoind.Value
end
end)
What solutions have you tried so far?
Searched did not find.
If your leaderstats are stored in the player, you didn’t specify the player but the character, to do so:
local Part100 = script.Parent
Part100.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if hit.Parent:FindFirstChild("Humanoid") then
local PlayerPoind = player.leaderstats.Points
PlayerPoind.Value = 0
end
end)