This is my code and the error:
I don’t know what to do since it is a blank line.
help pls
Full Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Events = ReplicatedStorage.Events
local Suits = ReplicatedStorage.Suits
local SkinsColors = ReplicatedStorage.SkinColors
local PlayersInGame = 0
local PlayerList = {}
local DataKeys = {"Suit","SkinColor","Fuel","Nose","Body","Suspension","ICE","Steering","Turbo","RearWing","Halo","FrontWing","BargeBoard","Energy"}
function ResetChar(Character,Data)
local CarSpawns = workspace:WaitForChild("CarSpawns")
local Suit = Suits[Data["Suit"]]
local SkinColor = Data["SkinColor"]
local Player = Players:GetPlayerFromCharacter(Character)
Character.Shirt.ShirtTemplate = Suit.Frame.ViewportFrame:GetChildren()[1].Shirt.ShirtTemplate
Character.Pants.PantsTemplate = Suit.Frame.ViewportFrame:GetChildren()[1].Pants.PantsTemplate
for i,v in pairs(Character:GetChildren()) do
if v then
if Character:WaitForChild(v.Name) then
if v:IsA("BasePart") then
v.Color = SkinColor
end
end
end
end
end
function SpawnCar(Player)
local CarSpawns = workspace:WaitForChild("CarSpawns")
local Character = Player.Character
local Car = ReplicatedStorage.Car:Clone()
local Spawn = CarSpawns[PlayerList[Player.Name]]
local Humanoid = Character:WaitForChild("Humanoid")
Car.Parent = workspace
Car:SetPrimaryPartCFrame(Spawn.CFrame)
Car.Parent = workspace.Cars
Car.Name = Player.Name
print(Car.Name)
local Seat = Car.VehicleSeat
repeat
if Humanoid.Health > 99 then
Seat:Sit(Humanoid)
end
wait(0.05)
until Humanoid.Health > 99 and Humanoid.Sit == true
end
Events.ServerMessage.OnServerEvent :Connect(function(Player, Message)
Events.AllClientMessage:FireAllClients(Message)
end)
Events.SpawnCar.OnServerEvent:Connect(function(Player)
SpawnCar(Player)
end)
Events.GiveServerData.OnServerEvent:Connect(function(Player,Data)
local Character = Player.Character
PlayersInGame += 1
PlayerList[Player.Name] = tostring(PlayersInGame)
ResetChar(Character,Data)
Events.CanSpawn:FireClient(Player)
Player.CharacterAdded:Connect(function(char)
ResetChar(char,Data)
SpawnCar(Player)
end)
Character.Humanoid.Died:Connect(function()
if workspace.Cars:FindFirstChild(Character.Name) then
workspace.Cars[Character.Name]:Destroy()
end
end)
end)