#Help Im trying to make it so when the rain touches a part it explodes

1 messages · Page 1 of 1 (latest)

ripe nest
#
local rainmodel = script.FX:WaitForChild("Rain")
local rainCount = 0
local CollectionService = game:GetService("CollectionService")
local TS = game:GetService("TweenService")
local info = TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local goal = {Size = Vector3.new(80, 80, 80), Transparency = 1}

remote.OnServerEvent:Connect(function(player)
    print("It's RAINING FIRE!!")
    while true do
        task.wait(0.1)
        rainCount = rainCount + 1
        print(rainCount)

        local newrainmodel = rainmodel:Clone()
        newrainmodel.Parent = game.Workspace

        local character = player.Character
        local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

        local radius = 40  -- How far the fireball is from the character
        local height = 80  -- How high above the character the fireball is
        local rotationSpeed = 180  -- How fast the fireball rotates

        local angle = tick() * rotationSpeed
        local fireballPosition = humanoidRootPart.Position + Vector3.new(math.cos(angle) * radius, height, math.sin(angle) * radius)

        newrainmodel.CFrame = CFrame.new(fireballPosition, humanoidRootPart.Position)

        if rainCount == 10 then
            rainCount = 0
            break
        end
        

        local touchedPlayers = {}

        newrainmodel.Touched:Connect(function(hit)
            local humanoid = hit.Parent:FindFirstChild("Humanoid")
            
        
            
            if humanoid then
                if hit.Parent == player.Character then
                    return
                end