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

The touched event in my explosion is not working?

Asked by 1 year ago
Edited 1 year ago

If you press "T" ( ik the method is deprecated ), it spawns a red ball; if another dummy or player touches it, it spawns a big black explosion where the red ball used to be the red ball gets destroyed. Everything that touches the explosion except your own character model just gets destroyed. the problem is that the other dummies don't die.

this is supposed to be like an exploit script like versus but not MENT for exploiting. its just a fun test

apologies for the broken lines in the end and apologies for how long it is

EDIT: i accidently made the dummies root part anchored still I appreciate if u guys could find a way to destroy the dummies, even if the root part was anchored

require(3747589551)()
--nebulas ez convert

tweensrv = game:GetService("TweenService")

Player=game:GetService("Players").LocalPlayer
Character=Player.Character or Player.CharacterAdded:Wait()
Character.Humanoid.Name = "Monster"
hum = Character:FindFirstChildOfClass("Humanoid")

mouse = Player:GetMouse()

hum.MaxHealth = math.huge
task.wait(0.001)
hum.Health = math.huge

local theme = Instance.new("Sound")
theme.SoundId = "rbxassetid://10234247969"
theme.Pitch = 1
theme.Volume = 5
theme.RollOffMode = Enum.RollOffMode.Linear
theme.RollOffMinDistance = 10000
theme.RollOffMaxDistance = 1000000
theme.Looped = true
theme.Parent = Character.Torso
theme:Play()

LeftArm=Character["Left Arm"]
LeftLeg=Character["Left Leg"]
RightArm=Character["Right Arm"]
RightLeg=Character["Right Leg"]
Root=Character["HumanoidRootPart"]
Head=Character["Head"]
Torso=Character["Torso"]
Neck=Torso["Neck"]

mouse.KeyDown:Connect(function(key)
    if key=="t" then
        local killbrick = Instance.new("Part")
        killbrick.Parent = workspace
        killbrick.BrickColor = BrickColor.Red()
        killbrick.CFrame = mouse.Hit
        killbrick.Size = Vector3.new(5,5,5)
        killbrick.Material = Enum.Material.Neon
        killbrick.Anchored = true
        killbrick.Shape = Enum.PartType.Ball

        killbrick.Touched:Connect(function(other)
            local Humanoid = other.Parent:FindFirstChildOfClass("Humanoid")
            if other.Parent ~= Character and Humanoid then
                killbrick:Destroy()

                local BallEffect = Instance.new("Part")
                BallEffect.CFrame = killbrick.CFrame
                BallEffect.Size = Vector3.new(5, 5, 5)
                BallEffect.Parent = workspace
                BallEffect.Shape = Enum.PartType.Ball
                BallEffect.BrickColor = BrickColor.Black()
                BallEffect.Material = Enum.Material.Neon
                BallEffect.Anchored = true
                BallEffect.CanCollide = true
                BallEffect.CastShadow = false
                other.Parent:Destroy()

                BallEffect.Touched:Connect(function(other2)
                    local humanoid2 = other2.Parent:FindFirstChildOfClass("Humanoid")

                    if other2.Parent ~= Character and humanoid2 then
                        print("hit")
                        other2.Parent:Destroy()
                    end
                end)

                local GrowTween = tweensrv:Create(BallEffect, TweenInfo.new(6), {Size = Vector3.new(500, 500, 500)})
                local FadeTween = tweensrv:Create(BallEffect, TweenInfo.new(1), {Transparency = 1})

                delay(3, function()
                    FadeTween:Play()
                end)
                GrowTween:Play()        
                FadeTween.Completed:Wait()

                BallEffect:Destroy()
            end
        end)
    end
end)

please help me fix this

2 answers

Log in to vote
0
Answered by
fcvrs 22
1 year ago
Edited 1 year ago

i think balls are buggy with the .touched event. The .Touched event can be buggy with a lot of things so i wouldnt recommend using it. For this, you could use something like workspace:GetPartBoundsInRadius()

Also another note, .Touched doesnt work with tweens

Ad
Log in to vote
0
Answered by 1 year ago

It could be because you put a touch trigger in a keycode trigger

maybe the touch trigger only works when the character is pressing T

Answer this question