this script that is supposed to change the models position only work in studio, but not ingame.

please help

script:

local s = script.Parent
local d = s.Parent.m.BodyVelocity
local e = d.Parent.statslol
local isincar = false
local uis = game:GetService("UserInputService")
d.MaxForce = Vector3.new(0,0,e.Acceleration.Value) * 10000

function yes(y)
	if y == "Throttle" then
		d.Velocity = Vector3.new(0,0,e.TopSpeed.Value) * s.Throttle
	end
end

s.Changed:Connect(yes)
s.ChildAdded:Connect(function(c)
	isincar = true
	s.Value.Value = c.Part1.Parent
end)
s.ChildRemoved:Connect(function()
	isincar = false
end)
uis.InputBegan:connect(function(k)
	if k.KeyCode == Enum.KeyCode.Space then
		if not isincar then
		return end
		d.Parent.DriftSound.Playing = true
		d.Parent.Parent.p.Smoke.Enabled = true
		d.Parent.Parent.pp.Smoke.Enabled = true
		s.Parent:SetPrimaryPartCFrame(s.Parent.m.CFrame * CFrame.Angles(0,-1,0) + Vector3.new(-15,0,0))
		end
end)
uis.InputEnded:connect(function(k)
	if k.KeyCode == Enum.KeyCode.Space then
		if not isincar then
		return end
				d.Parent.Parent.p.Smoke.Enabled = false
		d.Parent.Parent.pp.Smoke.Enabled = false
		d.Parent.DriftSound.Playing = false
		s.Parent:SetPrimaryPartCFrame(s.Parent.m.CFrame * CFrame.Angles(0,1,0) + Vector3.new(13,0,0))
		end
end)

thanks

1 comment

0

It's most likely an issue with FilteringEnabled. Look into it