#How do I make a fireball not damage me?

131 messages · Page 1 of 1 (latest)

keen quail
#
local Info = TweenInfo.new(10,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0)
local Sound = script.Parent.explode3


local tween = game:GetService("TweenService")

Block.Touched:Connect(function(hit, player)
    local humanoid = hit.Parent:WaitForChild("Humanoid")
    if hit.Parent:FindFirstChild("Humanoid") then
        script.Enabled = false
        
        local animator = Instance.new('Animator')
        animator.Parent = humanoid
        local animation = script.Parent.Animation
        humanoid.WalkSpeed = 0    
        local LoadAnim = animator:LoadAnimation(animation)
        LoadAnim:Play()
        
        wait(2.6)
        local Torso = humanoid.Parent:FindFirstChild("UpperTorso")
        
        local Ball = Instance.new("Part")
        Ball.Shape = Enum.PartType.Ball
        Ball.CanCollide = false
        Ball.Position  = Torso.Position
        Ball.Parent = Torso
        Ball.Anchored = true
        Ball.Color = Color3.new(1, 1,0)
        Ball.Material = Enum.Material.Neon
        Sound:Play()
        
        local Size = {Size=Vector3.new(50,50,50)}
        local TweenCreate = tween:Create(Ball,Info,Size)
        TweenCreate:Play()
        humanoid.WalkSpeed = 16
        
        wait(3)
        for i = 0, 1, 0.1 do
            wait(0.1)
            Ball.Transparency = i
        end
        
        
        wait(10)
        script.Enabled = true    
    end
        end
    end
    end)
tiny sail
#

add a creator tag and make in touched if creator = name of touched parent then dont do damage

tiny sail
#

np

keen quail
#

but

#

how

#

Ball.Touched?

tiny sail
#

yea

keen quail
#

So I do another function?

tiny sail
#

ball.touched:connect(function(hit,plr) if "creator tag value" == "plr name" then else "damage code" end end)

#

yes

#

also do denounce

#

cuz it will damage every time it hits another part

keen quail
#

ooh ok

keen quail
#

ok

#

ty

tiny sail
#

cooldown thingy

keen quail
#

ok ty

tiny sail
#

np*

keen quail
#

😻

tiny sail
keen quail
#

I could not understand

keen quail
tiny sail
#

string value

keen quail
#

Where would I put this string?

#

Do I create in the script itself?

tiny sail
#

in ball

keen quail
#

ok

keen quail
# tiny sail in ball

Like this?

            local Creator = Instance.new("StringValue")
            Creator.Parent = Ball
            Creator.Value = plr.Name
        
            if Creator.Value == plr.Name then
            else
                local humanoid = hit.Parent:FindFirstChild("Humanoid")
                humanoid.Health -= 25
            end
            end)```
tiny sail
#

yeah but you forgot debouce
this script will insta kill a player

keen quail
#

ye ye i know

keen quail
tiny sail
#

huh

#

hmmmm

#

oh wait.

keen quail
jovial tangleBOT
#

studio** You are now Level 3! **studio

tiny sail
#

you need to put

#

creator value in the start

#

and set the owner in there

keen quail
#

Start of script?

#

or the function

keen quail
tiny sail
#

do you have some kind sort of

keen quail
#

xd

tiny sail
#

it won't wort bc of 2 reasons

keen quail
#

I only have 1 week of programming

keen quail
tiny sail
#

you need to set the creator

keen quail
#

But isn't it already defined?

tiny sail
#

but the toucher of ball is a guy who doesnt own a ball right?

tiny sail
keen quail
#

ye

tiny sail
#

i uh

#

dont think so

keen quail
tiny sail
#

ye

keen quail
#

ok

tiny sail
# keen quail ok

uh btw can you give the explorer thingy where script is located

keen quail
#

Hm

#

I have a question, will the player parameter always return the player?

keen quail
tiny sail
#

hmm

#

that's is weird

#

im too confused to solve this!

#

yaho

keen quail
#

bruh

#

If you don't want to solve it, no problem.

tiny sail
#

no i mean

#

theres no possible way to set creator

keen quail
#

hm

tiny sail
#

it will just roll and damage i guess

keen quail
#

By the way, I had heard about a thing called IsDescendantOf

keen quail
tiny sail
#

np.

tiny sail
#

hope you get better at scripting

keen quail
hearty geyser
#

Like if the script is a descendant of a part, then you do stuff

tiny sail
#

if IDO then

jovial tangleBOT
#

studio** You are now Level 4! **studio

keen quail
#

And there are not so many roblox studio tutorials here

nova grotto
# keen quail

Ball.Touched:Connect(function(hit)
local e = hit.Parent
local ehum = e.Humanoid
if e.Name == Creator.Value then return end
ehum:TakeDamage(25)
end

nova grotto
#

replace the current touched script with that

keen quail
#

ok, wait a minute

keen quail
nova grotto
#

wdym

keen quail
#

?

nova grotto
#

acutlaly

#

you dont even need creator

keen quail
#

oh ok

nova grotto
#

youre making a useless value

#

if you already have the plr

keen quail
#

oh ok

keen quail
nova grotto
#

no

#

remove the local creator

#

replace creator.value in the .touched script with player.name

keen quail
#

?

#

or only value?

nova grotto
#

replace the entire .Touched script with this

#

Ball.Touched:Connect(function(hit)
local e = hit.Parent
local ehum = e.Humanoid
if e.Name == Player.Name then return end
ehum:TakeDamage(25)
end

keen quail
#

sure

jovial tangleBOT
#

studio** You are now Level 4! **studio

keen quail
#

Sorry if I misunderstood something, I'm not fluent

nova grotto
#

wait

#

what is player

keen quail
nova grotto
#

Block.Touched:Connect(function(hit)
local player = hit.Parent
local humanoid = player.Humanoid
rest of script blah blah blah
end

#

it should work now

keen quail
#

ok

#

It worked

nova grotto
#

nice

keen quail
#

Thank you for your help