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

Why does the kart fall apart every time i go to test it but when i play its ok?

Asked by 6 years ago

Basically once a player joins the game a kart will be spawned in with their stats, but the kart seems to be breaking every time i press test but when i press play its working fine and i tried making joints but that was no use.

-------------------
local Players = game:GetService("Players")
local Kart = script.Parent.Kart.GoKart

function onPlayerAdded(player)

    warn(player.Name .. " has entered the game, so a Go Kart will be spawned")

----------------------------------------------------------------------------------------------------GO KART
---[[
                           --//setting up the Go kart stuff//--

local ClonedKart           = Kart:Clone()

--PlaceHolder 
local KartSettings         = player:WaitForChild("Kart")

--Body
local GoKartBody           = ClonedKart.Body.MeshSections.Livery.Body

--Rims
local FlRim                = ClonedKart.Wheels.FL.Parts.Rim
local FrRim                = ClonedKart.Wheels.FR.Parts.Rim
local RlRim                = ClonedKart.Wheels.RL.Parts.Rim
local RrRim                = ClonedKart.Wheels.RR.Parts.Rim

                           --//Spawn Stuff//--

--Random Pit Spawn
local spawns = workspace.Game.KartSpawners:GetChildren()
local random = spawns[math.random(1,#spawns)]

--Spawn Effect
local SpawnEffect = GoKartBody.SpawnEffect

--Plate
local KartingNumber        = KartSettings.KartingNumber.value
local KartingNumberColour1 = KartSettings.KartingNumberColour1.value
local KartingNumberColour2 = KartSettings.KartingNumberColour2.value
local Writing = ClonedKart.Name

--Colors
local KartColour           = KartSettings.BodyColour.value
local WheelColour          = KartSettings.WheelColour.Value

--Reflectance
local KartReflectance      = KartSettings.BodyReflection.value
local WheelReflectance     = KartSettings.WheelReflection.value

                           --// Spawning the kart //--

--ClonedKart:MakeJoints()
ClonedKart:SetPrimaryPartCFrame(random.CFrame + Vector3.new(0,20,0))
player.Character.HumanoidRootPart.CFrame = ClonedKart.PrimaryPart.CFrame + Vector3.new(0,10,0)
player.Character.Humanoid.WalkSpeed = 1
ClonedKart.Name            = (player.Name.."'s GoKart")
ClonedKart.Parent          = game.Workspace.Game.SpawnedGoKarts

SpawnEffect.Enabled        = true

warn((ClonedKart.Name).." Is being spawned in")

wait(2)

--player.Character.HumanoidRootPart.CFrame = ClonedKart.PrimaryPart.CFrame + Vector3.new(0,10,0)
--player.Character.Humanoid.WalkSpeed = 1

SpawnEffect.Enabled        = false

                           --// Kart Asthetics //--

--KartBody
GoKartBody.Reflectance     = (KartReflectance)
GoKartBody.BrickColor      = BrickColor.new(KartColour)
GoKartBody.TextureID       = KartSettings.Livery.value

--Kart Wheel Colours
FlRim.BrickColor           = BrickColor.new(WheelColour)
FrRim.BrickColor           = BrickColor.new(WheelColour)
RlRim.BrickColor           = BrickColor.new(WheelColour)
RrRim.BrickColor           = BrickColor.new(WheelColour)

--Kart Wheel Reflections
FlRim.Reflectance    = (WheelReflectance)
FrRim.Reflectance    = (WheelReflectance)
RlRim.Reflectance    = (WheelReflectance)
RrRim.Reflectance    = (WheelReflectance)

--Karing Number/Text
ClonedKart.Body.Plates.NumberPlate.Front.SGUI.Identifier.Text = (KartingNumber)
ClonedKart.Body.Plates.NumberPlate.Rear.SGUI.Identifier.Text  = (KartingNumber)
ClonedKart.Body.Plates.NumberPlate.Name.SGUI.Identifier.Text  = (Writing)
---]]

1 answer

Log in to vote
0
Answered by
ZenTGE 4
6 years ago

Is the Kart anchored?

Ad

Answer this question