wait(4)
local Player = script.Parent.Parent.Parent
local Items = game.ReplicatedStorage.Karts
local Platform = game.ReplicatedStorage.Platform
local FirstItem = game.ReplicatedStorage.Karts.Kart
local Camera = workspace.CurrentCamera
local sample = script.Parent.ScrollingFrame.Sample:Clone()
local Item = nil
local spawns = workspace.Spawns:GetChildren()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
--game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
--game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
game:GetService("StarterGui"):SetCore("TopbarEnabled", false)
script.Parent.Parent.LeaderBoard.Enabled = false
script.Parent.Parent.Menu.Enabled = false

if not Camera:FindFirstChild("Platform") then
	local Cloned = Platform:Clone()
	Cloned.Parent = Camera
end

if not Camera:FindFirstChild("PrevItem") then
	local Cloned = FirstItem:Clone()
	Cloned.Parent = Camera
	Cloned:MakeJoints()
	Item = FirstItem
	Cloned:SetPrimaryPartCFrame(Camera:FindFirstChild("Platform").TheCFrame.CFrame+Vector3.new(0,2,0))
	Cloned.Name = "PrevItem"
end

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Camera:FindFirstChild("Platform").CameraCFrame.CFrame

for i,v in pairs(script.Parent.ScrollingFrame:GetChildren()) do
	if v.Name ~= "Sample" then
		v:Destroy()
	end
end

wait(1)
script.Parent.ScrollingFrame:TweenPosition(UDim2.new(0,50,0,50))
script.Parent.Play:TweenPosition(UDim2.new(0.428,0,.9,0))

for i,v in pairs(Items:GetChildren()) do
	local a = sample:Clone()
	a.Parent = script.Parent.ScrollingFrame
	a.Position = UDim2.new(0,0,0,25*(i-1))
	a.Name = v.Name
	a.Text = v.Name
	a.Visible = true
	script.Parent.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,(25*i))
end

local choosecan = false
for i,v in pairs(script.Parent.ScrollingFrame:GetChildren()) do
	v.MouseButton1Click:connect(function()
		if Camera:FindFirstChild("PrevItem") then
			if choosecan == true then return end
			choosecan = true			
			Camera.PrevItem:Destroy()
			local realitem = game.ReplicatedStorage.Karts:FindFirstChild(v.Name)
			if realitem then
				local Cloned = realitem:Clone()
				Cloned.Parent = Camera
				Cloned:MakeJoints()
				Cloned:SetPrimaryPartCFrame(Camera:FindFirstChild("Platform").TheCFrame.CFrame+Vector3.new(0,0,0))
				Cloned.Name = "PrevItem"
				Item = realitem
			end
			choosecan = false
		end
	end)
end
local playcan = false
script.Parent.Play.MouseButton1Click:connect(function()
	if playcan == true then return end
	if Item ~= nil then
		playcan = true
		script.Parent.Blackanimate.BackgroundTransparency = 1
		for i = 1,10 do
			script.Parent.Blackanimate.BackgroundTransparency = script.Parent.Blackanimate.BackgroundTransparency -.1
			wait()
		end
		local Cloned = Item:Clone()
		Cloned.Parent = Camera
		Cloned:MakeJoints()
		local random = spawns[math.random(1,#spawns)]
		Cloned:SetPrimaryPartCFrame(random.CFrame +Vector3.new(0,2,0))
		Camera.PrevItem:Destroy()
		Cloned.Parent = workspace.SpawnedGoKarts
		Cloned.Name = (Player).Name.."'s GoKart"
		script.Parent.ScrollingFrame.Visible = false
		script.Parent.Play.Visible = false
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 10
		game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = Cloned.PrimaryPart.CFrame+Vector3.new(0,10,0)
		Camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
		Camera.CameraType = Enum.CameraType.Custom
		script.Parent.Parent.LeaderBoard.Enabled = true
		script.Parent.Parent.Menu.Enabled = true
		script.Parent.Blackanimate.BackgroundTransparency = 0
		game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
		game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
		for i = 1,10 do
			script.Parent.Blackanimate.BackgroundTransparency = script.Parent.Blackanimate.BackgroundTransparency +.1
			wait()
		end
		playcan = false
	end
end)

2 comments

0

I think in line 7 you need to make that an event, since you are cloning something, but i'm not sure.

0

yea you do but i dno how ;/