Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AlertCreator()
- for i,v in ipairs(game.Players:GetPlayers()) do
- if v.userId == game.CreatorId then
- if script:findFirstChild('AllowThirdPartySalesNotice') then
- if not v.PlayerGui:findFirstChild('AllowThirdPartySalesNotice') then
- script.AllowThirdPartySalesNotice:Clone().Parent = v.PlayerGui
- end
- end
- end
- end
- end
- wait(.1)
- if not workspace.AllowThirdPartySales then AlertCreator() end
- KartAssetId = 193064098 -- Don't mess with this or your warranty is void LOL SO FUNNEH!!
- Ids = {
- ['G'] = 306060116,
- ['C'] = 336722242,
- ['M'] = 336724563,
- ['I'] = 336725370,
- ['R'] = 336726773,
- }
- count = 0
- repeat wait() count = count+1 until count >= 5
- -- define variables
- Kart = script.Parent
- Steeringwheel = Kart.SteeringWheel
- Configurations = Kart.Configurations
- BodyColor = Configurations.BodyColor
- SeatColor = Configurations.SeatColor
- ChassisColor = Configurations.ChassisColor
- Number = Configurations.Number
- Body = Kart.Body
- Chassis = Kart.Chassis
- Seat = Kart.Seat
- Tires = Kart.Tires
- NumberDisplay = Seat.SeatWedge.SurfaceGui.TextLabel
- VehicleSeat = Seat.VehicleSeat
- Sounds = Kart.SteeringWheel
- Engine = Sounds.Engine
- Horn = Sounds.Horn
- MainEvent = Kart.RemoteEvents:WaitForChild('MainEvent')
- CS = VehicleSeat.ControllerScript -- we'll use this in-case anything were to happen where we'd lose the ControllerScript
- repeat wait() until Kart:FindFirstChild("Version")
- local version = Kart.Version.Value
- local IsInvisible = false
- local IsMLGMode = false
- local mode = 1
- KartStorage = {}
- CharacterStorage = {}
- CreatedItems = {}
- function GetCurrentVal(color)
- for i = 0, 127 do
- if BrickColor.palette(i) == color then
- return i
- end
- end
- end
- function GetColor3(r,g,b)
- return Color3.new(r/255,g/255,b/255)
- end
- function GetNumberSequence(start,stop)
- return NumberSequence.new(start,stop)
- end
- function GetNumberRange(start,stop)
- return NumberRange.new(start,stop)
- end
- function EliteMode()
- if mode == 1 then
- prevColor = BodyColor.Value
- prevMaterial = Body:GetChildren()[1].Material
- for i,v in ipairs(Body:GetChildren()) do
- v.BrickColor = BrickColor.new('Deep orange')
- v.Reflectance = 0.5
- v.Material = Enum.Material.Neon
- end
- end
- end
- function UnEliteMode()
- for i,v in ipairs(Body:GetChildren()) do
- v.BrickColor = prevColor
- v.Reflectance = 0
- v.Material = prevMaterial
- end
- end
- function CreateMLGParticles()
- -- MLG Particles
- local P1 = Instance.new('ParticleEmitter')
- P1.Color = ColorSequence.new(GetColor3(255,255,255),GetColor3(255,255,255))
- P1.LightEmission = 1
- P1.Size = GetNumberSequence(1,1)
- P1.Texture = 'http://www.roblox.com/asset/?id=201320071'
- P1.Transparency = GetNumberSequence(0.8,.8)
- P1.ZOffset = 0
- P1.Acceleration = Vector3.new(0,0,0)
- P1.Drag = 0
- P1.LockedToPart = false
- P1.VelocityInheritance = 0
- P1.EmissionDirection = Enum.NormalId.Top
- P1.Enabled = true
- P1.Lifetime = GetNumberRange(1,1)
- P1.Rate = math.random(12,50)
- P1.Rotation = GetNumberRange(0,0)
- P1.RotSpeed = GetNumberRange(0,0)
- P1.Speed = GetNumberRange(1,1)
- P1.VelocitySpread = 500
- local P2 = Instance.new('ParticleEmitter')
- P2.Color = ColorSequence.new(GetColor3(127,225,36),GetColor3(60,143,29))
- P2.LightEmission = 1
- P2.Size = GetNumberSequence(1,1)
- P2.Texture = 'http://www.roblox.com/asset/?id=208253379'
- P2.Transparency = GetNumberSequence(.8,.8)
- P2.ZOffset = 0
- P2.Acceleration = Vector3.new(0,0,0)
- P2.Drag = 0
- P2.LockedToPart = false
- P2.VelocityInheritance = 0
- P2.EmissionDirection = Enum.NormalId.Top
- P2.Enabled = true
- P2.Lifetime = GetNumberRange(50,50)
- P2.Rate = math.random(12,50)
- P2.Rotation = GetNumberRange(0,0)
- P2.RotSpeed = GetNumberRange(0,0)
- P2.Speed = GetNumberRange(1,1)
- P2.VelocitySpread = 500
- local P3 = Instance.new('ParticleEmitter')
- P3.Color = ColorSequence.new(GetColor3(255,255,255),GetColor3(255,255,255))
- P3.LightEmission = 1
- P3.Size = GetNumberSequence(1,1)
- P3.Texture = 'http://www.roblox.com/asset/?id=179012130'
- P3.Transparency = GetNumberSequence(0.8,.8)
- P3.ZOffset = 0
- P3.Acceleration = Vector3.new(0,0,0)
- P3.Drag = 0
- P3.LockedToPart = false
- P3.VelocityInheritance = 0
- P3.EmissionDirection = Enum.NormalId.Top
- P3.Enabled = true
- P3.Lifetime = GetNumberRange(50,50)
- P3.Rate = math.random(12,50)
- P3.Rotation = GetNumberRange(0,0)
- P3.RotSpeed = GetNumberRange(0,0)
- P3.Speed = GetNumberRange(1,1)
- P3.VelocitySpread = 500
- local P4 = Instance.new('ParticleEmitter')
- P4.Color = ColorSequence.new(GetColor3(127, 225, 36),GetColor3(60, 143, 29))
- P4.LightEmission = 1
- P4.Size = GetNumberSequence(1,1)
- P4.Texture = 'http://www.roblox.com/asset/?id=216633597'
- P4.Transparency = GetNumberSequence(0.8,.8)
- P4.ZOffset = 0
- P4.Acceleration = Vector3.new(0,0,0)
- P4.Drag = 0
- P4.LockedToPart = false
- P4.VelocityInheritance = 0
- P4.EmissionDirection = Enum.NormalId.Top
- P4.Enabled = true
- P4.Lifetime = GetNumberRange(50,50)
- P4.Rate = math.random(12,50)
- P4.Rotation = GetNumberRange(0,0)
- P4.RotSpeed = GetNumberRange(0,0)
- P4.Speed = GetNumberRange(1,1)
- P4.VelocitySpread = 500
- local P5 = Instance.new('ParticleEmitter')
- P5.Color = ColorSequence.new(GetColor3(255, 255, 255),GetColor3(255, 255, 255))
- P5.LightEmission = 1
- P5.Size = GetNumberSequence(1,1)
- P5.Texture = 'http://www.roblox.com/asset/?id=218792778'
- P5.Transparency = GetNumberSequence(0.8,.8)
- P5.ZOffset = 0
- P5.Acceleration = Vector3.new(0,0,0)
- P5.Drag = 0
- P5.LockedToPart = false
- P5.VelocityInheritance = 0
- P5.EmissionDirection = Enum.NormalId.Top
- P5.Enabled = true
- P5.Lifetime = GetNumberRange(50,50)
- P5.Rate = math.random(12,50)
- P5.Rotation = GetNumberRange(0,0)
- P5.RotSpeed = GetNumberRange(0,0)
- P5.Speed = GetNumberRange(1,1)
- P5.VelocitySpread = 500
- local P6 = Instance.new('ParticleEmitter')
- P6.Color = ColorSequence.new(GetColor3(255, 255, 255),GetColor3(255, 255, 255))
- P6.LightEmission = 1
- P6.Size = GetNumberSequence(1,1)
- P6.Texture = 'http://www.roblox.com/asset/?id=157979926'
- P6.Transparency = GetNumberSequence(0.8,.8)
- P6.ZOffset = 0
- P6.Acceleration = Vector3.new(0,0,0)
- P6.Drag = 0
- P6.LockedToPart = false
- P6.VelocityInheritance = 0
- P6.EmissionDirection = Enum.NormalId.Top
- P6.Enabled = true
- P6.Lifetime = GetNumberRange(1,1)
- P6.Rate = math.random(12,50)
- P6.Rotation = GetNumberRange(0,0)
- P6.RotSpeed = GetNumberRange(0,0)
- P6.Speed = GetNumberRange(1,1)
- P6.VelocitySpread = 500
- local MLGEffects = {P1,P2,P3,P4,P5,P6}
- return MLGEffects
- end
- MLGEffects = CreateMLGParticles()
- function MLGMode(plr,val)
- if val then
- for i,v in ipairs(plr.Character:GetChildren()) do
- if v:IsA('Hat') or v:IsA('Tool') then
- table.insert(CharacterStorage,v:Clone())
- v:Destroy()
- end
- end
- for i,v in ipairs(CreatedItems) do
- v:Destroy()
- end
- CreatedItems = {}
- local MLGShades = Instance.new('Hat')
- MLGShades.AttachmentForward = Vector3.new(0,0,-1)
- MLGShades.AttachmentPos = Vector3.new(0,.38,.1)
- MLGShades.AttachmentRight = Vector3.new(1,0,0)
- MLGShades.AttachmentUp = Vector3.new(0,1,0)
- local ShadesHandle = Instance.new('Part',MLGShades)
- ShadesHandle.Name = 'Handle'
- ShadesHandle.FormFactor = Enum.FormFactor.Custom
- ShadesHandle.CanCollide = true
- ShadesHandle.Size = Vector3.new(1,1,1)
- ShadesHandle.BackSurface = Enum.SurfaceType.SmoothNoOutlines
- ShadesHandle.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
- ShadesHandle.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
- ShadesHandle.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
- ShadesHandle.RightSurface = Enum.SurfaceType.SmoothNoOutlines
- ShadesHandle.TopSurface = Enum.SurfaceType.SmoothNoOutlines
- local MLGMesh = Instance.new('SpecialMesh',ShadesHandle)
- MLGMesh.MeshId = 'http://www.roblox.com/asset/?id=121910245'
- MLGMesh.MeshType = Enum.MeshType.FileMesh
- MLGMesh.Offset = Vector3.new(0,0,0)
- MLGMesh.Scale = Vector3.new(.7,.5,.7)
- MLGMesh.TextureId = 'http://www.roblox.com/asset/?id=121947422'
- MLGMesh.VertexColor = Vector3.new(1,1,1)
- local ObeyHat = Instance.new('Hat')
- ObeyHat.AttachmentForward = Vector3.new(0,0,-1)
- ObeyHat.AttachmentPos = Vector3.new(0,-.15,0)
- ObeyHat.AttachmentRight = Vector3.new(1,0,0)
- ObeyHat.AttachmentUp = Vector3.new(0,1,0)
- local HatHandle = Instance.new('Part',ObeyHat)
- HatHandle.Name = 'Handle'
- HatHandle.FormFactor = Enum.FormFactor.Custom
- HatHandle.CanCollide = true
- HatHandle.Size = Vector3.new(1,1,1)
- HatHandle.BackSurface = Enum.SurfaceType.SmoothNoOutlines
- HatHandle.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
- HatHandle.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
- HatHandle.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
- HatHandle.RightSurface = Enum.SurfaceType.SmoothNoOutlines
- HatHandle.TopSurface = Enum.SurfaceType.SmoothNoOutlines
- local HatMesh = Instance.new('SpecialMesh',HatHandle)
- HatMesh.MeshId = 'http://www.roblox.com/asset/?id=13030731'
- HatMesh.MeshType = Enum.MeshType.FileMesh
- HatMesh.Offset = Vector3.new(0,0,0)
- HatMesh.Scale = Vector3.new(.95,.95,.95)
- HatMesh.TextureId = 'http://www.roblox.com/asset/?id=70262300'
- HatMesh.VertexColor = Vector3.new(1,1,1)
- ObeyHat.Parent,MLGShades.Parent = plr.Character,plr.Character
- table.insert(CreatedItems,MLGShades)
- table.insert(CreatedItems,ObeyHat)
- for i,v in ipairs(MLGEffects) do
- local Clone = v:Clone()
- Clone.Parent = Kart.PrimaryPart
- table.insert(CreatedItems,Clone)
- end
- elseif not val then
- for i,v in ipairs(CreatedItems) do
- v:Destroy()
- end
- CreatedItems = {}
- for i,v in ipairs(CharacterStorage) do
- v.Parent = plr.Character
- CharacterStorage = {}
- end
- end
- end
- function MakeInstancesInvisible(par,val)
- for i,v in ipairs(par:GetChildren()) do
- if v:IsA('BasePart') or v:IsA('Decal') then
- if v.Name ~= 'HumanoidRootPart' then
- v.Transparency = val
- MakeInstancesInvisible(v,val)
- end
- elseif v:IsA('SurfaceGui') then
- if val == 1 then
- v.Enabled = false
- else
- v.Enabled = true
- end
- elseif not v:IsA('BasePart') and not v:IsA('Decal') and not v:IsA('SurfaceGui') then
- MakeInstancesInvisible(v,val)
- end
- end
- end
- function InvisibleFunction(plr)
- for i,v in ipairs(CreatedItems) do
- v:Destroy()
- end
- CreatedItems = {}
- if not IsInvisible then
- MakeInstancesInvisible(Kart,1)
- for i,v in ipairs(plr.Character:GetChildren()) do
- if v:IsA('Hat') or v:IsA('Tool') then
- table.insert(CharacterStorage,v:Clone())
- v:Destroy()
- end
- end
- MakeInstancesInvisible(plr.Character,1)
- IsInvisible = true
- else
- MakeInstancesInvisible(Kart,0)
- for i,v in ipairs(CharacterStorage) do
- v.Parent = plr.Character
- CharacterStorage = {}
- end
- MakeInstancesInvisible(plr.Character,0)
- IsInvisible = false
- end
- end
- function NextColor()
- local CurrentVal = GetCurrentVal(Configurations.BodyColor.Value)
- local NewVal = 0
- if CurrentVal < 127 then
- NewVal = CurrentVal+1
- else
- NewVal = 0
- end
- Configurations.BodyColor.Value = BrickColor.palette(NewVal)
- end
- function PrevColor()
- local CurrentVal = GetCurrentVal(Configurations.BodyColor.Value)
- local NewVal = 0
- if CurrentVal > 0 then
- NewVal = CurrentVal-1
- else
- NewVal = 127
- end
- Configurations.BodyColor.Value = BrickColor.palette(NewVal)
- end
- function FlipKart()
- local x, y, z, RX,RY,RZ = Kart.PrimaryPart.CFrame.x,Kart.PrimaryPart.CFrame.y,Kart.PrimaryPart.CFrame.z,0,0,0
- Kart:SetPrimaryPartCFrame(CFrame.new(x,y,z)*CFrame.Angles(RX,RY,RZ))
- end
- function LoadLatestVersion()
- local LatestVersion = game:GetService("InsertService"):LoadAsset(KartAssetId)
- for _,v in pairs(LatestVersion:GetChildren()) do
- if v:IsA('Model') then
- LatestVersion = v
- end
- end
- if LatestVersion and LatestVersion:FindFirstChild("Version") and LatestVersion.Version:IsA("IntValue") and LatestVersion.Version.Value > version then
- LatestVersion:MakeJoints()
- LatestVersion.Parent = Kart.Parent
- LatestVersion:SetPrimaryPartCFrame(Kart.PrimaryPart.CFrame)
- LatestVersion:MakeJoints()
- LatestVersion.Configurations.BodyColor.Value = Kart.Configurations.BodyColor.Value
- LatestVersion.Configurations.ChassisColor.Value = Kart.Configurations.ChassisColor.Value
- LatestVersion.Configurations.Number.Value = Kart.Configurations.Number.Value
- LatestVersion.Configurations.SeatColor.Value = Kart.Configurations.SeatColor.Value
- Kart:Destroy()
- end
- end
- LoadLatestVersion()
- vals = {
- BodyColor,
- SeatColor,
- ChassisColor,
- Number
- }
- AlreadyBugged = {} -- we'll use this table to keep track of those we already asked if they'd like to purchase the go kart, so we don't bug 'em. :)
- function ColorBody(color)
- for i,v in pairs(Body:GetChildren()) do
- v.BrickColor = color
- end
- end
- function ColorSeat(color)
- for i,v in pairs(Seat:GetChildren()) do
- v.BrickColor = color
- end
- end
- function ColorChassis(color)
- for i,v in pairs(Chassis:GetChildren()) do
- v.BrickColor = color
- end
- end
- function ChangeNumber(val)
- NumberDisplay.Text = val
- end
- actions = {
- [BodyColor] = function(val)
- ColorBody(val)
- end,
- [SeatColor] = function(val)
- ColorSeat(val)
- end,
- [ChassisColor] = function(val)
- ColorChassis(val)
- end,
- [Number] = function(val)
- ChangeNumber(val)
- end,
- }
- for _,v in ipairs(vals) do
- actions[v](v.Value)
- end
- for _,v in ipairs(vals) do
- v.Changed:connect(function(change)
- actions[v](change)
- end)
- end
- function CheckIfAlreadyBugged(plr)
- for i,v in ipairs(AlreadyBugged) do
- if v == plr then
- return true
- end
- end
- end
- AskedToPurchaseGas = {}
- function YesOrNo(plr)
- for i,v in ipairs(AskedToPurchaseGas) do
- if v == plr then
- return true
- end
- end
- end
- function StartSoundPitch(hu)
- while wait() and hu and hu.Sit == true do
- if VehicleSeat.Velocity.magnitude < VehicleSeat.MaxSpeed - 20 then
- Engine.Pitch = math.rad(VehicleSeat.Velocity.magnitude and (80+VehicleSeat.Velocity.magnitude))/1.6
- end
- end
- end
- VehicleSeat.ChildAdded:connect(function(child)
- if not workspace.AllowThirdPartySales then AlertCreator() end
- if child:IsA('Weld') then
- if VehicleSeat:findFirstChild('ControllerScript') == nil then
- CS:Clone().Parent = VehicleSeat
- end
- local char = child.Part1.Parent
- PlrFromChar = game.Players:GetPlayerFromCharacter(char)
- local hu = char.Humanoid
- delay(0,function()StartSoundPitch(hu)end)
- Engine:Play()
- KartVal = Instance.new('ObjectValue',PlrFromChar)
- KartVal.Name = 'CodeWrighterKartDetection'
- KartVal.Value = Kart
- cs = VehicleSeat.ControllerScript
- cs.Parent = PlrFromChar.PlayerGui
- cs.Disabled = false
- if PlrFromChar.userId > -2 then
- if PlrFromChar:findFirstChild('Elite') then
- EliteMode()
- end
- if not game:GetService('MarketplaceService'):PlayerOwnsAsset(PlrFromChar,Ids['G']) then
- if PlrFromChar.MembershipType == Enum.MembershipType.None then
- game:GetService('MarketplaceService'):PromptPurchase(PlrFromChar,Ids['G'],false,Enum.CurrencyType.Tix)
- --table.insert(AskedToPurchaseGas,PlrFromChar)
- else
- game:GetService('MarketplaceService'):PromptPurchase(PlrFromChar,Ids['G'],false,Enum.CurrencyType.Tix)
- --table.insert(AskedToPurchaseGas,PlrFromChar)
- end
- end
- end
- end
- end)
- VehicleSeat.ChildRemoved:connect(function(child)
- if child:IsA('Weld') then
- cs = PlrFromChar.PlayerGui.ControllerScript
- local GUI = PlrFromChar.PlayerGui.ControlsHUD
- GUI.Parent = cs
- local KartVal = PlrFromChar:findFirstChild('CodeWrighterKartDetection')
- if KartVal then
- KartVal:Destroy()
- end
- if IsInvisible then
- InvisibleFunction(PlrFromChar)
- end
- if IsMLGMode then
- MLGMode(PlrFromChar,false)
- IsMLGMode = false
- end
- UnEliteMode()
- cs.Disabled = true
- cs.Parent = VehicleSeat
- Engine:Stop()
- end
- end)
- repeat wait() until Kart:findFirstChild('ClickDetector')
- Kart.ClickDetector.MouseClick:connect(function(plr)
- if plr.userId > -2 and not game:GetService('MarketplaceService'):PlayerOwnsAsset(plr,KartAssetId) then
- --if not CheckIfAlreadyBugged(plr) then
- game:GetService('MarketplaceService'):PromptPurchase(plr,KartAssetId)
- --table.insert(AlreadyBugged,plr)
- --end
- end
- end)
- MainEvent.OnServerEvent:connect(function(plr,action,ID)
- if action == 'PlayHorn' then
- Horn:Play()
- elseif action == 'StopHorn' then
- Horn:Stop()
- elseif action == 'Invisibility' then
- if game:GetService('MarketplaceService'):PlayerOwnsAsset(plr,Ids['I']) then
- -- invisible
- InvisibleFunction(plr)
- else
- game:GetService('MarketplaceService'):PromptPurchase(plr,Ids['I'])
- end
- elseif action == 'Flip' then
- -- flip kart
- FlipKart()
- elseif action == 'PrevColor' then
- -- previous color
- if game:GetService('MarketplaceService'):PlayerOwnsAsset(plr,Ids['C']) then
- PrevColor()
- else
- game:GetService('MarketplaceService'):PromptPurchase(plr,Ids['C'])
- end
- elseif action == 'NextColor' then
- -- next color
- if game:GetService('MarketplaceService'):PlayerOwnsAsset(plr,Ids['C']) then
- NextColor()
- else
- game:GetService('MarketplaceService'):PromptPurchase(plr,Ids['C'])
- end
- elseif action == 'MLGMode' then
- -- MLG mode
- if game:GetService('MarketplaceService'):PlayerOwnsAsset(plr,Ids['M']) then
- if IsMLGMode then
- MLGMode(plr,false)
- IsMLGMode = false
- else
- MLGMode(plr,true)
- IsMLGMode = true
- end
- else
- game:GetService('MarketplaceService'):PromptPurchase(plr,Ids['M'])
- end
- elseif action == 'Radio' then
- if game:GetService('MarketplaceService'):PlayerOwnsAsset(plr,Ids['R']) then
- local RadioSong = Steeringwheel.RadioSong
- RadioSong.SoundId = 'rbxassetid://'..ID
- RadioSong:Play()
- else
- game:GetService('MarketplaceService'):PromptPurchase(plr,Ids['R'])
- end
- elseif action == 'PauseRadio' then
- local RadioSong = Steeringwheel.RadioSong
- RadioSong:Pause()
- elseif action == 'UnpauseRadio' then
- local RadioSong = Steeringwheel.RadioSong
- RadioSong:Resume()
- elseif action == 'UnrepeatRadio' then
- local RadioSong = Steeringwheel.RadioSong
- RadioSong.Looped = false
- elseif action == 'RepeatRadio' then
- local RadioSong = Steeringwheel.RadioSong
- RadioSong.Looped = true
- end
- end)
- if not game.ServerScriptService:findFirstChild('CWPurchasePrompter') then
- script.CWPurchasePrompter.Parent = game.ServerScriptService
- else
- script.CWPurchasePrompter:Destroy()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement