Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

i need help fixing my car gui spawner can anyone help?

Asked by 3 years ago
Edited 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

my car gui spawner spawn multipe of the car help

``local player = game.Players.LocalPlayer local ReplicatedStorage = game:GetService("ReplicatedStorage") local SpawnCarEvent = ReplicatedStorage:WaitForChild("SpawnCar") local DeleteCarEvent = ReplicatedStorage:WaitForChild("DeleteCar") local carName = script.Parent.Name local SpawnCarFrame = script.Parent.Parent

script.Parent.MouseButton1Down:Connect(function() SpawnCarFrame.Visible = false local CurrentCar = game.Workspace:FindFirstChild(player.Name .. 'sCar') if not CurrentCar then SpawnCarEvent:FireServer(carName) 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) end end)


``local ServerStorage = game:GetService("ServerStorage") local ReplicatedStorage = game:GetService("ReplicatedStorage") local SpawnCarEvent = ReplicatedStorage:WaitForChild("SpawnCar") local DeleteCarEvent = ReplicatedStorage:WaitForChild("DeleteCar")

SpawnCarEvent.OnServerEvent:Connect(function(player, carName) local Car = ServerStorage:FindFirstChild("Cars"):FindFirstChild(carName) local CurCar = game.Workspace:FindFirstChild(player.Name .. 'sCar') if CurCar then CurCar:Remove() end if Car then local clonedCar = Car:Clone() clonedCar.Name = player.Name .. 'sCar' clonedCar.Parent = game.Workspace clonedCar:MoveTo(player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector * 15) end end)

DeleteCarEvent.OnServerEvent:Connect(function(player, Car) local Car = game.Workspace:FindFirstChild(player.Name .. 'sCar') if Car then Car:Remove() end end)

game.Players.PlayerRemoving:Connect(function(player) local Car = game.Workspace:FindFirstChild(player.Name .. 'sCar') if Car then Car:Remove() end end)

game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local Car = game.Workspace:FindFirstChild(player.Name .. 'sCar') if Car then Car:Remove() end end) end)


local CarSpawnerFrame = script.Parent.Parent.Frame

script.Parent.MouseButton1Down:Connect(function() CarSpawnerFrame.Visible = not CarSpawnerFrame.Visible end)


script.Parent.MouseEnter:Connect(function() script.Parent.ImageTransparency = 0 script.Parent.ImageColor3 = Color3.fromRGB(200,200,200) end) script.Parent.MouseLeave:Connect(function() script.Parent.ImageTransparency = 0.5 script.Parent.ImageColor3 = Color3.fromRGB(255,255,255) end)

0
Can you encode it in lua so we can understand it better, please? ym5a 52 — 3y
0
Idk how pokeybevermon -5 — 3y
0
Did you write this script yourself? DietCokeTastesGood 111 — 3y
0
no pokeybevermon -5 — 3y

Answer this question