I tried making a script but I only know how to set a value for example = 1 not make it increase
This is my code:
if script.Parent.Touched:Connect(function() local LPlayer = game.Players.LocalPlayer.Name game.LPlayer.leaderstats.laps.Value = +1 end)
It looks like you're a beginner scripter, so try learning the basics and then go on and study events. But anyway, to answer the question, you have to say LPlayer.leaderstats.laps.Value = LPlayer.leaderstats.laps.Value + 1
. This basically means value is equal to value plus 1
. Also, you don't have to say game.LPlayer
since it's a variable. Below is what the full script would look like.
script.Parent.Touched:Connect(function(hit) local LPlayer = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) LPlayer.leaderstats.laps.Value = LPlayer.leaderstats.laps.Value + 1 end)
You should remove the if in if script.Parent.Touched:Connect(function()
since it would error. And finnaly, you shouldn't use game.Players.LocalPlayer
in a ServerScript, as it would return nil. Please try doing more research on Roblox Lua before asking.