String value doesn't appear on leaderboard

  1. What do you want to achieve?
    All I need is 1 simple fix to this because I already tested this with a part but, want this so when you spawn your car after selecting the car, it shows plays what cars they have

  2. What is the issue? Include screenshots / videos if possible!
    their seems to be an error within this part, down below

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    most of the other solutions don’t talk about what I’m looking for

look at the leaderboard, you will notice the car spawned in but, the name isn’t on their.

script.Parent.MouseButton1Click:Connect(function(player)
	local RandomStatsName = player.leaderstats.CurrentCar--error here
	RandomStatsName.Value = script.Parent.Parent.Car_Name.Text
end)

also the error read: (Players.cookpie416.PlayerGui.ScreenGui.Frame.Frame.Spawn_Button.Leaderboard_VehicleName:2: attempt to index nil with ‘leaderstats’)

MouseButton1Click won’t give you the player. (Hopefully) your using a local script, because it won’t work with a server script. If you want to set a leaderstat, you’ll have to use a server script, but you should listen to the button press on the client, then use a remote with the server to tell it to update the stat. (Be careful with that)

1 Like

knew that had something to due with that, also plus just using this just for vehicle names, but alright.