I'm fairly new to Lua and need help with a vehicle script. I'm trying to turn the player that sits in my vehicle turn completely invisible.
Place this in the seat or change the self variable to the path of the seat:
--[[ Unlimitus ]]-- -- Vehicle Seat Transparency Script -- local character = nil local self = script.Parent local debounce = false function Touched (hit) if debounce == false then if character == nil then -- Prevents more than one player being affected by this function if hit.Parent:findFirstChild("Humanoid") then character = hit.Parent wait(0.1) -- Wait for the character to sit if character ~= nil then if character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then for _, child in pairs(character:GetChildren()) do if child:IsA("Accoutrement") then child = child.Handle end if child:IsA("BasePart") then -- BasePart is a class that all "Parts" fall under if child.Name ~= "HumanoidRootPart" then -- This is a brick not meant for view child.Transparency = 1 end end end local function HumanoidJumped() if character ~= nil then if character.Humanoid.Jump == true then for _, child in pairs(character:GetChildren()) do if child:IsA("Accoutrement") then child = child.Handle end if child:IsA("BasePart") then if child.Name ~= "HumanoidRootPart" then child.Transparency = 0 end end end if debounce == false then debounce = true character.Torso.CFrame = self.CFrame * CFrame.new(0, 1 + self.Size.Y / 2, -3) character = nil wait(1) debounce = false end end end end character.Humanoid.Changed:connect(HumanoidJumped) end end end end end end self.Touched:connect(Touched)
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then _G.Character = hit.Parent hit.Parent["Left Leg"].Transparency = 1 hit.Parent["Right Leg"].Transparency = 1 hit.Parent.Torso.Transparency = 1 hit.Parent["Right Arm"].Transparency = 1 hit.Parent["Left Arm"].Transparency = 1 hit.Parent.Head.Transparency = 1 end end) script.Parent.TouchEnded:connect(function(left) _G.Character["Left Leg"].Transparency = 0 _G.Character["Right Leg"].Transparency = 0 _G.Character.Torso.Transparency = 0 _G.Character["Right Arm"].Transparency = 0 _G.Character["Left Arm"].Transparency = 0 _G.Character.Head.Transparency = 0 end)
This isn't an request site, please refer to the ROBLOX Wiki.