I need a script where if a player seats on the vehicle seat, the player becomes invisible.
Any help is appreciated!
I need a script where if a player seats on the vehicle seat, the player becomes invisible.
Any help is appreciated!
local WantedTransparency = 1 -- Change this to the transparency you want it to be.
script.Parent.ChildAdded:Connect(function()
if script.Parent.Occupant then
for i,v in pairs(script.Parent.Occupant.Parent:GetChildren()) do
if v:IsA("BasePart") then
if v.Name == "HumanoidRootPart" then
-- Will ignore HumanoidRootPart
else
v.Transparency = WantedTransparency
end
elseif v:IsA("Accessory") then
v.Handle.Transparency = WantedTransparency
end
end
end
end)
Thank you! Works like charm!
local WantedTransparency = 1 – Change this to the transparency you want it to be.
script.Parent.ChildAdded:Connect(function()
if script.Parent.Occupant then
for i,v in pairs(script.Parent.Occupant.Parent:GetChildren()) do
if v:IsA(“BasePart”) then
if v.Name == “HumanoidRootPart” then
– Will ignore HumanoidRootPart
else
v.Transparency = WantedTransparency
end
elseif v:IsA(“Accessory”) then
v.Handle.Transparency = WantedTransparency
end
end
end
end)
local WantedTransparency = 0
script.Parent.ChildRemoved:Connect(function()
if script.Parent.Occupant then
for i,v in pairs(script.Parent.Occupant.Parent:GetChildren()) do
if v:IsA(“BasePart”) then
if v.Name == “HumanoidRootPart” then
– Will ignore HumanoidRootPart
else
v.Transparency = WantedTransparency
end
elseif v:IsA(“Accessory”) then
v.Handle.Transparency = WantedTransparency
end
end
end
end)