#Were when the players heath gets to 0 it spawns "gary" :)

1 messages · Page 1 of 1 (latest)

wispy cosmos
#

player = game.Players.LocalPlayer
health = player.Character.Humanoid.Health
local part = Instance.new("gary") part.name = "gary"
if player health = 0 then = spawn"gary"part.position = Vector3.new(player)
end

you know i have no clue how to code when you read this lol

amber elk
#

should this be client or server sided?

#

@wispy cosmos

wispy cosmos
#

it dont work lol

tranquil thornBOT
#

studio** You are now Level 1! **studio

wispy cosmos
#

idk

amber elk
#

do you want other people to see this or not

wispy cosmos
#

what do you mean?

amber elk
#

do you want other people to see gary

#

or not

#

only for player or for all players

split arrow
#

Basically do you want Gary to either only exist on the device currently playing or the entire game as a whole

amber elk
#

@wispy cosmos ?

wispy cosmos
#

idk

amber elk
#

lets do server then

wispy cosmos
#

ok, does not work tho the script

amber elk
#

Also, you need a gary model ready for use in replicated storage. I will write the script for you HOWEVER

#

this script will only spawn a part on the player.

split arrow
# wispy cosmos ok, does not work tho the script

Couple things, first off

  • When you want to check if a value is equal to something, use a double equals sign
local health = 100

if health == 100 then
print("full health")
end
--output = full health
  • Second, when you create an object/clone it using object:clone() you MUST parent it to something otherwise it stays a variable and only exist in code
local bob = Instance.new("part")
--bob doesnt exist yet
bob.Parent = game.Workspace
--now bob is in the workspace/ bob has spawned
  • third, just an error here but with code but you've got to have an actual vector 3 when using Vector3.new which would be player.Character.HumanoidRootPart.Position
amber elk
#

ok but that still wont work

wispy cosmos
#

What is bob at parent or a kid?

#

or whats it called

#

is bob a category or something in a category

split arrow
#

the way parenting works is basically just how you put objects inside of an object or service in a game

split arrow
wispy cosmos
#

class = part/object?

split arrow
#

class = Anything in the game, its basically what makes a part a part, a script a script and so on

tranquil thornBOT
#

studio** You are now Level 2! **studio

wispy cosmos
#

where would i put this?

#

the module

split arrow
#

In a regular script in server script service

amber elk
#

wait

#

i found a glitch

#

dont use this

#

it still generates more bruh

split arrow
#

its because you arent closing the connection and starting multiple

#

Sorry Lm if this is confusing

amber elk
#

ok @wispy cosmos this is the final script: ``` local debounce = false

game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")

humanoid:GetPropertyChangedSignal("Health"):Connect(function()
    if humanoid.Health <= 0 then
        if debounce == false then
            debounce = true
            local gary = Instance.new("Part")
            gary.Name = "Gary"
            gary.Parent = game.Workspace
            gary.Anchored = true
            gary.Position = char.HumanoidRootPart.Position
            wait(0.1)
            debounce = false
            return
        end
    end
end)

end)```

#

NO

#

NOOOOO

#

now

wispy cosmos
#

what does local debounce mean?

amber elk
#

Its a cooldown

#

in the script

split arrow
#

yea that

amber elk
#

ok it still doesnt fking work

#

ima crash out

split arrow
#

close the connection after death 🙏

amber elk
#

im returning it

#

a shit

#

ofc

#

im returning it

#

bruh

wispy cosmos
#

Hey i got to go ill prob talk later

#

bye

split arrow
#

bye

amber elk
#

i fumbled so bad

#

I just wanted good sad

hushed drift
#

what the fucking shit am i reading

amber elk
#

its salamis script

#

not mine

split arrow
#

liar

amber elk
#

i dont have anything to do with this

hushed drift
#

guys.

amber elk
#

no please

#

spare me

#

i tried

hushed drift
#

the OP doesn't know shit about coding

split arrow
#

I know

hushed drift
#

why ar eyou making the script for him

amber elk
#

he wanted

hushed drift
#

if he doesn't even understand coding

amber elk
#

bro im just being nice 🙏

#

he wants gary

#

so i made gary

hushed drift
#

okay lets just

split arrow
#

but he doesnt understand how gary works

hushed drift
#

yeah

#

i mean look at his code

amber elk
#

no please

#

bro

#

i beg you

hushed drift
#

not u bro

#

op's

amber elk
#

ok good

hushed drift
#

im gonna leave brawl's playsit

amber elk
#

ok well

#

finish the code tho

#

im to stupid to make it work

split arrow
#

b r o

#

function:Disconnect() 🙏

amber elk
#

????

#

wtf

#

thats a thing?

split arrow
#

yes bro

amber elk
#

ive been scripting for

#

4 years

hushed drift
#

This is the first episode and beginning to become a Roblox Scripter/Game Developer! With 3 playlists (Beginner, Advanced, GUI) containing 50+ videos and 30+ hours of content, I will guide you through this journey to start making the games you want to create on Roblox!

DISCORD 📜
Join my Discord Community if you want scripting help, participat...

▶ Play video
#

no bro

amber elk
#

how the HELL

#

did i not know this

hushed drift
#

:Disconnect only works with RBXSignals

hushed drift
split arrow
#

oh rip me then im not very familiar with closing connections

split arrow
amber elk
#

i tried return

#

but

#

:(

#

im stupid

hushed drift
#

local connection = Part.Touched:Connect(function() blah blah

end)

connection disconnect

#

im deadass

split arrow
#

Oh lol thats what i was referring to but im so used to it i forgot to explain

#

😭

hushed drift
#

bru

amber elk
#

maybe its time for some tutorials again.

split arrow
#

possibly

amber elk
#

@finite lodge

tranquil thornBOT
#

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

wispy cosmos
#

What does this do?