So i made a car spawner, that spawns a car if you click G. It works in studio. The car works, and the body doesnt fall apart, and i can drive it. But when i test it in game, the body falls apart, and i cant sit in the seat. The script is placed in the playergui/startergui. Can somebody help me? thanks!

script:

local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local name = plr.Name..("'s Car")
local debounce = false
uis.InputBegan:connect(function(key)
	if key.KeyCode == Enum.KeyCode.G then
for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren())do
	if v:IsA("Model") and v.Name == name then
	v:Destroy()

	end
	end
	end
end)
uis.InputEnded:connect(function(aey)
	wait()
	if aey.KeyCode == Enum.KeyCode.G then
		 local car = plr.SelectedCar.Value:Clone()
		car.Parent = game.Players.LocalPlayer.Character
		car.Chassis.Base.Anchored = true
		car.Name = plr.Name..("'s Car")
		car:SetPrimaryPartCFrame(plr.Character.Head.CFrame * CFrame.new(0,0,-10))
		car:MakeJoints()
		wait(1)
		car.Chassis.Base.Anchored = false
	end
end)

6 comments

0

do you have filtering enabled on?

0

no

0

FE is always on bc of the update even if u turn it off

0

:connect() is decaperated use :Connect() and is ur script inside a local script or a server script

0

localscript. also, i think connect() and Connect are the same thing, just with an capital C.

0

also, i dont think fe is forced on even tho its off, i printed if filteringenabled is true or false and it said false