Hello developers,
-
What do I want to achieve? I want the rain particle to enable when the “IsRaining” value is set to true and vice versa when it is set to false
-
What is the issue? The particle is not enabling even though the “IsRaining” value is changing
-
What solutions have I’ve tried so far? I tried setting the value by using Roblox’s Attribute system, but that didn’t work, I also tried changing the transparency of the particle instead of the “Enabled” value, but that also didn’t work. Finally, I have looked on the Devforum and searched my issue on the web.
I’m making a rain system. I have a “main” script within StarterPlayerScripts (and it is a local script). I also have the part I’m cloning above the player’s head (which this part contains the particle emitter) within ReplicatedStorage. There is a script within Workspace which changes the “IsRaining” value (which is a bool value and this boolValue is in the Workspace too). As I mentioned above, everything is working but the particle for the rain is not enabling/disabling.
Script:
local player = game.Players.LocalPlayer
local part = game.ReplicatedStorage:WaitForChild("RainPart")
local weld = Instance.new("Weld")
local rainVal = game.Workspace:WaitForChild("IsRaining")
local partClone = part:Clone()
function insertRainPart()
local char = player.Character
partClone.Parent = char
partClone.Anchored = false
partClone.CanCollide = false
partClone.Name = "RainPartCLONE"
weld.Parent = partClone
weld.Part1 = partClone
weld.Part0 = char.HumanoidRootPart
weld.C1 = CFrame.new(0,-30,5)
end
wait(1)
insertRainPart()
player.Character.Humanoid.Died:Connect(function()
wait(6)
insertRainPart()
end)
while task.wait(1) do
if rainVal == true then
partClone.RainEmitter.Enabled = true
else
partClone.RainEmitter.Enabled = false
end
end
If anyone knows how to fix this it would be great help and thanks (and sorry if this is an easy solution)!