The 2nd parameter should be specified:
local Event = game.ReplicatedStorage.Leaderboard_CarNameEvent
Event.OnServerEvent:Connect(function(player, value)
player.leaderstats.CurrentCar.Value = value
end)
FindFirstChild
also is not necessary.
The 2nd parameter should be specified:
local Event = game.ReplicatedStorage.Leaderboard_CarNameEvent
Event.OnServerEvent:Connect(function(player, value)
player.leaderstats.CurrentCar.Value = value
end)
FindFirstChild
also is not necessary.
Well answer is it’s still the same, only you/client can see the vehicle name, not the server (and still the CurrentCar) values are still empty for both players. It should be just straight to the point but, something is going on here.
Alright, well if you are using the SpawnCar
RemoteEvent
to spawn your cars, why not just use that to set the leaderstat value as well?
Well I have a screenshot showing how it all works below: (this might make it easier to find the issue or not)
Now I’m confused. Probably because it’s very late at night for me, but if I understand correctly, this is something on the server’s end. So, I can’t really help much but give generic advice.
I recommend adding some print
statements to print out the value when you change it (the leaderstats).
I also recommend checking if you are sending the value correctly from the client to the server. Since the car is spawning correctly, we know that’s not the problem in most cases.
I hope this helps, but if not, I’ll help in the morning (of course if it’s not solved, which is highly unlikely).
Show me 3 scripts, ill help you.
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SpawnCarEvent = ReplicatedStorage:WaitForChild("SpawnCar")
local DeleteCarEvent = ReplicatedStorage:WaitForChild("DeleteCar")
local carName = script.Parent.Spawn_Car_Name
local SpawnCarFrame = script.Parent.Parent
local FaVeNa = player:FindFirstChild("leaderstats"):FindFirstChild("CurrentCar")
script.Parent.MouseButton1Down:Connect(function()
FaVeNa.Value = script.Parent.Parent.Car_Name.Text
local CurrentCar = game.Workspace:FindFirstChild(player.Name .. 'sCar')
if not CurrentCar then
SpawnCarEvent:FireServer(carName.Value)
else
if player.Character.Humanoid.SeatPart ~= nil and player.Character.Humanoid.SeatPart:IsA("VehicleSeat") then
player.Character.Humanoid.Sit = false
end
wait()
DeleteCarEvent:FireServer(CurrentCar)
SpawnCarEvent:FireServer(carName.Value)
end
end)
local Clicked = script.Parent
local player = game.Players.LocalPlayer
Clicked.MouseButton1Click:Connect(function()
game.ReplicatedStorage.Leaderboard_CarNameEvent:FireServer()
end)
local Event = game.ReplicatedStorage.Leaderboard_CarNameEvent
Event.OnServerEvent:Connect(function(player, value)
player.leaderstats.CurrentCar.Value = value
end)
This is also how the car names are changed
When you click on car 1/4 button, it changes to the fake name of the vehicle I put in
local CarNameValue = script.Parent.Parent.Parent.Frame
local Vehicle_Spawn_Name = script.Parent.Vehicle_Spawn_Name
local Fake_Vehicle_Name = script.Parent.Fake_Vehicle_Name
script.Parent.MouseButton1Click:Connect(function()
CarNameValue.Spawn_Button.Spawn_Car_Name.Value = (Vehicle_Spawn_Name.Value)
CarNameValue.Car_Name.Text = (Fake_Vehicle_Name.Value)
end)
The normal vehicle/non fake names doesn’t matter just the fake name only.
in the second script
change
game.ReplicatedStorage.Leaderboard_CarNameEvent:FireServer()
to
game.ReplicatedStorage.Leaderboard_CarNameEvent:FireServer(carName)
if you need any more help you can dm me here or Msix29#7740
@cookpie416 actually dm me on discord i wanna talk about something
ok/alright will do so right away