Car regenerate script duplicates car by amount of players?

Did you move the model:Destroy()? If so, then maybe.

I moved the Destroy() line, yes.

I’m ashamed to say I have zero clue why your script is broken :sad:

Actually, from what I can tell, it appears to just be making clones of Lowenherz but the Lowenherzs in the workspace are just empty models.

You realize you can simply do this in a car regeneration script

The original position of the car is where it will spawn everytime, for the sake of this post lets put it at 0,0,0.

local originalcar = game.Workspace-- whatever car you are using.
local beginning = Vector3.new(0, 0, 0)
local magnitude = vector3.new(15, 15, 15)
while wait(10) do
if originalcar.Position ~= beginning and (originalcar.Position - beginning).Magnitude >  magnitude

then
local newcar = originalcar:Clone()
newcar.Position = beginning; newcar.Parent =  game.Workspace
     end
end


Also, why would you make it so that if the playe

I don’t want to rewrite the script, I want it fixed.

Oh, ok. though, I suggest you take out the “enabled” var and put it in the remotevent parameter. But, also, can you show us the client script that you are adding it on to, I think the event is okay, not the client script.

edit: remote event looks okay, but it is most likely a client side issue.

I don’t know scripting terms so maybe you can try to simplify that for me?
Here is the client-script

script.Parent.MouseButton1Click:connect(function()
    game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz:FireServer()
end)

No wonder, that’s why. when you do a client script, you forgot to add “player” in the event, hence it will not start up.

game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function()

the parameter supposed to be here is “player”

so, here is the right one for this line.

game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function(player)

you do not have to add anything to the FireServer event, it is merely because you forgot the “player” parameter.

Nope, still duplicates by players.

Oh okay. The last thing I probably think is happening is that you do a click event on the screengui itself. you see, every single time a player joins a game, all of screengui is replicated inside of Players.LocalPlayer.PlayerGui…

That being said, this might be the solution.

client script

local players = game:GetService("Players")
local player = players.LocalPlayer

local replicatedstorage = game:GetService("ReplicatedStorage")
local remotesfolder = replicatedstorage:WaitForChild("LowenherzRemotes")
local remoteevent = remotesfolder:WaitForChild("RegenLowenHerz")

repeat wait() until player.Character or player.CharacterAdded

player.PlayerGui["example"].MouseButton1Down:Connect(function()
remoteevent:FireServer()
end


I just get this generic error.
CharacterAdded is not a valid member of Player

Oops. Sorry. I made the mistake of adding a colion instead of a period. Changed it now

Now I just get this.

example is not a valid member of PlayerGui

you’re supposed to add the name of the gui that you mentioned here:

You never mentioned what is the name of script.Paret (which is a gui)

That’s a regenerate button. Take a look at the example rbxl in the main post.

I don’t really understand what you’re trying to say here. I’ll just tell you the issue at hand, because you did the localscript and mentioned the gui that was in the screengui, it duplicates for the screen of the whole server. This is how it works. If you do a touched event in screengui, it duplicates for the whole server. If you try to change the pos of the gui, it doesn’t work. Also, if you do game.Players.LocalPlayer.PlayerGui.regeneratebutton, it will work, duplicate for the client only, and because it is firing a remote event it works. That’s why. I don’t really know exactly what you need, because the issue is not with the event, and is with the fact that you did it on screengui.

What? The GUI is in the car’s remote control tool.

Hmm, okay then. I think I’m just really bad at understanding things. I’ll get it to work and then reply with the file. Though it will take some time because I still have geometry homework to do.