Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help, what is going on with this lightingbolt spawner?

Asked by 3 years ago
Edited 3 years ago

So i made a script that when it starts raining it randomly makes thunders appear, but when i clone them they dont show up in the workspace. server:

game.ReplicatedStorage.Thunder.OnServerEvent:Connect(function(plr)
    local thunderBolt = game.ReplicatedStorage.thunderBolt:Clone()
    thunderBolt.Parent = workspace
    thunderBolt.Position = plr.Character.Head.Position + Vector3.new(math.random(-thunderBolt.Size.X * 2,thunderBolt.Size.X * 2),thunderBolt.Size.Y/ 2,math.random(-thunderBolt.Size.Z * 2,thunderBolt.Size.Z * 2))
    thunderBolt.Orientation = Vector3.new(0,math.random(-180,180),90)
    workspace.Terrain.thunderBolt.Value = true
    wait(3)
    workspace.Terrain.thunderBolt.Value = false
end)

game.ReplicatedStorage.RainOfftoServer.OnServerEvent:Connect(function()
    game.ReplicatedStorage.RainOff:FireAllClients()
end)

local:

function rain()
    chr.itsRaining.Value = true
    rainStart:Play()
    wait(10)
    Rain:Enable(ti)
    script.Parent.temperatureAdder.Value = -6
**  for i = 1,60 do
        wait(1)
        local a = math.random(1,5)
        if a == 1 and workspace.Terrain.thunderBolt.Value == false then
            game.ReplicatedStorage.Thunder:FireServer()
        end
    end**
    game.ReplicatedStorage.RainOfftoServer:FireServer()
end

i can't understand whats happening, i made so when a thunder appears it tells me it parent like "print(thunder.Parent" and it says its workspace but its not there! theres nothing that destroys the thunder either

Answer this question