Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
TheRob666 -54
5 years ago

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) ~~~~~~~~~~~~~~~~

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 RetroGalacticGamer 331 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
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. :)

0
Don't use Instance.new() with a parent argument -- parent should always be the last property set. SummerEquinox 643 — 5y
0
Can You Do A Script With Data Storing Please? So It can Save Wins For Others Too :D TheRob666 -54 — 5y
0
That is quite hard. You should post another question about that. greenhamster1 180 — 5y
0
^ xXTouchOfFrostXx 125 — 5y
Ad

Answer this question