Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

When Players Touches Part, Them get a point, Help please?

I have done an Obby but when Player finishes Them doesn't get a Point, Or It won't be saved, any help?

print("starting")
l

game.Players.PlayerAdded:Connect(function(player)
 local folder = Instance.new("Folder", player)
 folder.Name = "leaderstats"
 local wins = Instance.new("IntValue", folder)
 Finished.Name = "Finished"


workspace.FinishPart.Touched:Connect(function()
            Finished.Value = Finished.Value + 1


    end
end)
~~~~~~~~~~~~~~~~

1 comment

0

ok so basically this is pretty simple make a touched event and add a point to the intvalue where a players "points" are stored in

1 answer

print("starting")
local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder", player)
folder.Name = "leaderstats"
local wins = Instance.new("IntValue", folder)
wins.Name = "Finished"
workspace.FinishPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
  local character = Players:GetPlayerFromCharacter(hit.Parent)
  wins.Value = wins.Value + 1
end

end)
end)

Please use a code block next time. :)

4 comments

0

Don't use Instance.new() with a parent argument -- parent should always be the last property set.

0

Can You Do A Script With Data Storing Please? So It can Save Wins For Others Too :D

0

That is quite hard. You should post another question about that.

0

^

This discussion is preserved as it was. New answers, comments, and votes are closed.