I need help trying to grab player username sercersided for my car spawned so it renamed there vehicle player names car and I can’t figure out how to get the players name to rename it
Screenshots
Code
Server Sided script
> local event = game.ReplicatedStorage.Username
>
> event.OnServerEvent:Connect(function(Username)
>
> local plr = Username
>
> end)
>
> script.Parent.MouseButton1Click:Connect(function(plr)
>
> wait(5)
>
> local a = script.Parent.Parent.Parent.Parent.Player.Value
>
> -- plr.leaderstats.Money.Value = plr.leaderstats.Money.Value -500
>
> local car = game.ServerStorage.Cars.Mustang:Clone()
>
> car.Parent = game.Workspace.Vehicles
>
> car.Name = plr.." Vehicles"
>
> script.Parent.Parent.Parent.Parent.CarSpawn.Visible=false
>
> end)```
**Local Script**
```script.Parent.MouseButton1Click:Connect(function(plr)
local username = game.ReplicatedStorage.Username
local player = game.Players.LocalPlayer
username:FireServer(player.Name)
script.Parent.Parent.Vehicle.Visible=true
local text = script.Parent.Parent.Vehicle
local default = "SPAWNING VEHICLE ("
local default2 = ")"
text.TextColor3 = Color3.fromRGB(255, 255, 255)
wait(1)
text.Text = default.."4"..default2
wait(1)
text.Text = default.."3"..default2
wait(1)
text.Text = default.."2"..default2
wait(1)
text.Text = default.."1"..default2
wait(1)
text.Text = default.."0"..default2
wait(1)
text.TextColor3 = Color3.fromRGB(38, 255, 14)
text.Text = "Succesfully Spawned!"
wait(3)
text.Visible=false
end)
Could you be a more in-depth in what you are trying to do/can you provide the code to your original source in a code box for us to be able to help you fix this? Please check the guidelines and rules of the Developer forum before posting.
You don’t actually need the strings part, in fact, you don’t even need anything fired over, all you have to do is fireserver, and do player.Name(no need to define player again)