Hello so i found a Rain Local script but i can’t loop it i tried to do while true do then wait but it didnt worked if someone can help its
local plr = game.Players.LocalPlayer
local char = plr.Character
local head = char.Head
local rainpart = script.RainPart
local rainRay = Ray.new(head.Position,Vector3.new(0,1000,0)) – Goes up from player’s head.
local ignoreTable = {char, rainpart}
local rs = game:GetService(“RunService”)
script.Sound:Play()
script.Sound2:Play()
rs.RenderStepped:Connect(function()
local plr = game.Players.LocalPlayer
local char = plr.Character
local head = char.Head
local rainRay = Ray.new(workspace.CurrentCamera.CFrame.Position,Vector3.new(0,1000,0)) -- Goes up from player's head.
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("BasePart") then
if v.Transparency >= 1 then
table.insert(ignoreTable,i+2,v)
wait()
end
end
end
local hit, position = workspace:FindPartOnRayWithIgnoreList(rainRay, ignoreTable)
if hit then
rainpart.Parent = script
if script.Sound2.Volume == 0 then
local part = script.Sound
local tween = game:GetService("TweenService")
local tweeningInfo = TweenInfo.new(
1.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local partPor = {
Volume = 0
--Position = Vector3.new(0, 10, 10)
--SetPrimaryPartCFrame(workspace.pepos)
}
local RTween = tween:Create(part, tweeningInfo, partPor)
RTween:Play()
-- VOLUME UP
local part = script.Sound2
local tween = game:GetService("TweenService")
local tweeningInfo = TweenInfo.new(
1.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local partPor = {
Volume = 0.5
--Position = Vector3.new(0, 10, 10)
--SetPrimaryPartCFrame(workspace.pepos)
}
local RTween = tween:Create(part, tweeningInfo, partPor)
RTween:Play()
end
print("Ray was hit.")
else
if script.Sound.Volume == 0 then
local part = script.Sound
local tween = game:GetService("TweenService")
local tweeningInfo = TweenInfo.new(
1.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local partPor = {
Volume = 3
--Position = Vector3.new(0, 10, 10)
--SetPrimaryPartCFrame(workspace.pepos)
}
local RTween = tween:Create(part, tweeningInfo, partPor)
RTween:Play()
-- VOLUME DOWN
local part = script.Sound2
local tween = game:GetService("TweenService")
local tweeningInfo = TweenInfo.new(
1.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local partPor = {
Volume = 0
--Position = Vector3.new(0, 10, 10)
--SetPrimaryPartCFrame(workspace.pepos)
}
local RTween = tween:Create(part, tweeningInfo, partPor)
RTween:Play()
end
rainpart.Parent = workspace
rainpart.Position = Vector3.new(workspace.CurrentCamera.CFrame.Position.X, workspace.CurrentCamera.CFrame.Position.Y+10, workspace.CurrentCamera.CFrame.Position.Z)
print("No part found.")
end
end)