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

(Edit) Why isn't the explosion appearing?

Asked by 5 years ago

This script essentially generates an orb, and shoots in out where your mouse cursor is, it will then blow up. Everything is working well, except for the explosion. It wont appear.

I have absolutely NO clue as to why its

game.ReplicatedStorage.Moves.OnServerEvent:Connect(function(plr,mousehit,key)
    if key == "Shakkahou" then
        local char = plr.Character
        local hum = char.Humanoid
        local root = char.HumanoidRootPart
        local charging = Instance.new("Part")
        charging.Size = Vector3.new(1,1,1)
        charging.Transparency = 0.5
        charging.CanCollide = false
        charging.BrickColor = BrickColor.new("Really red")
        charging.Shape = Enum.PartType.Ball
        charging.Material = Enum.Material.Neon
        charging.Parent = workspace
local weld = Instance.new("Weld")
    charging.CFrame = root.CFrame * CFrame.new(0,1.3,-2)
    weld.Part0 = root
    weld.Part1 = charging
    weld.C0 = root.CFrame:Inverse()
    weld.C1 = charging.CFrame:Inverse()
    weld.Parent = charging
    wait(1)
    weld:Destroy()
    local bv = Instance.new("BodyVelocity")
    bv.Parent = charging
    bv.MaxForce = Vector3.new(1e8,1e8,1e8)
    bv.Velocity = mousehit.lookVector*50 
    game.Debris:AddItem(charging,5)
    local debounce = false
    charging.Touched:Connect(function(hit)
        if debounce == false then
        debounce = true
        local ehum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
        if ehum and ehum ~= hum then
            ehum:TakeDamage(10)
        end
        local explosion = Instance.new("Part",workspace)
        explosion.Size = Vector3.new(1,1,1)
        explosion.Transparency = 0.5
        explosion.CanCollide = false
        explosion.Name = "Explosion"
        explosion.BrickColor = BrickColor.new("Really red")
        explosion.Shape = Enum.PartType.Ball
        explosion.Material = Enum.Material.Neon
        explosion.Position = CFrame.new(charging.CFrame.x,mousehit.y,charging.CFrame.z) 
        local tween = game:GetService("TweenService")
        local tweeninfo = TweenInfo.new(2,Enum.EasingStyle.Quint,Enum.EasingDirection.In,0,false,0)
        local tweenproperties = {Size = Vector3.new(50,50,50)}
        tween:Create(explosion,tweeninfo,tweenproperties)
        wait(2)
        local tweeninfo2 = TweenInfo.new(1,Enum.EasingStyle.Quint,Enum.EasingDirection.In,0,false,0)
        local tweenproperties2 = {Transparency = 1,Size = Vector3.new(40,40,40)}
        tween:Create(explosion,tweeninfo2,tweenproperties2)
        wait(1)
        explosion:Destroy()
        wait(5)
        debounce = false
        end
        end)
    end
end)

0
tween:Create() doesn't play the tweens. You have to set a variable equal to the result of it, then play that. local explodeTween = tween:Create(etc..); explodeTween:Play() chomboghai 2044 — 5y
0
While what you said is true, even after applying it, it still didn't work, thanks anyways. DominousSyndicate 41 — 5y
0
I don't know much about tweening and suchlike. Does the thing need to be anchored? Is it falling out of the map? User#21908 42 — 5y
0
I have already experimented with that, however it didn't work, also are you more into lerping? DominousSyndicate 41 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

First of all you didn't actually play the tweens, however reading the comments suggests that it didn't work anyways. The most logical reason I have for is that you didn't parent the explosion to anything. Here is what it should look like (Not saying you don't know how to parent just in case you didn't understand me):

        local explosion = Instance.new("Part",workspace)
        explosion.Size = Vector3.new(1,1,1)
        explosion.Transparency = 0.5
        explosion.CanCollide = false
        explosion.Name = "Explosion"
        explosion.BrickColor = BrickColor.new("Really red")
        explosion.Shape = Enum.PartType.Ball
        explosion.Material = Enum.Material.Neon
        explosion.Position = CFrame.new(charging.CFrame.x,mousehit.y,charging.CFrame.z)
    --And The Parent
    explosion.Parent = charging --OR Wherever it should be parented.

REMEMBER TOO play the tweens so everything works fine. Just a reminder to keep your script working :)

0
But the explosion already does have a parent, the second parameter of the instance.new() DominousSyndicate 41 — 5y
0
OH SORRY, I didn't see that MaximumOverdriven 152 — 5y
0
Although, i'm gonna keep your method because the one I used is deprecated. DominousSyndicate 41 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago

This appears to be an issue on roblox's end. I've had the same issue. Check if your explosion spawns in the center of the map (0,0,0).

0
Use comments if you're not going to answer the question. This should be a comment. User#19524 175 — 5y
0
It isn't spawning at all DominousSyndicate 41 — 5y

Answer this question