I need some help with my script, I would like the Owner value to be set to the Player’s Name and the OwnerId value set to the Player’s UserId, But I can’t get it. Can somebody help please?
local enabled = false
local function spawnVehicleForPlayer(Player)
if enabled == false then
enabled = true
local Mod = game.ServerStorage.Vehicles['Lamborghini Aventador']
local clone = Mod:Clone()
clone.Parent = workspace.Vehicles
local ControlValues = clone:WaitForChild("Control_Values")
ControlValues.Owner.Value = Player.Name
ControlValues.OwnerId.Value = Player.UserId
clone:MakeJoints()
wait(25)
enabled = false
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()
spawnVehicleForPlayer(Player)
end)
end)
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
spawnVehicleForPlayer(player)
end)