Now this is the script inside the button gui. I click it multiple of times but it doesn't function because I put the print above when it fires

script.Parent.MouseButton1Click:connect(function(GetCar)
	local ModelName = "ARVBE"
	script.Parent.Visible = false
	wait(.1)
	print(ModelName)
	game.ReplicatedStorage.CarSpawn:FireServer(ModelName)

end)

ServerScriptService

game.ReplicatedStorage.CarSpawn.OnServerEvent:connect(function(ModelName)
	print(ModelName)
	if ModelName == "ARVBE" then		
		local Mod = game.ServerStorage[ModelName]
		Mod.ATSWelder.Disabled = false
		local clone = Mod:clone()
		clone.Parent = workspace
		clone:MakeJoints()
	end
end)

4 comments

0

Please put your code in a code block it makes it easier to read.

0

Edited for code block.

0

The first parameter OnServerEvent returns is always the player. You have to define the player first in the server script, then you can define ModelName in the parameters 2nd.

0

Remember that only local scripts can use FireServer()