Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Simple script for a PSX type roblox game
- -- Define pet properties
- local pet = script.Parent
- local petName = "My Pet"
- local petMaxHealth = 100
- local petCurrentHealth = petMaxHealth
- -- Define pet functions
- function takeDamage(damageAmount)
- petCurrentHealth = petCurrentHealth - damageAmount
- if petCurrentHealth <= 0 then
- pet:Destroy() -- Destroy the pet when its health reaches 0
- end
- end
- function heal(healAmount)
- petCurrentHealth = math.min(petCurrentHealth + healAmount, petMaxHealth) -- Clamp health to max health
- end
- -- Connect pet functions to events
- pet.Touched:Connect(function(hit)
- local part = hit.Parent
- local humanoid = part:FindFirstChild("Humanoid")
- if humanoid then
- takeDamage(10) -- Reduce pet's health by 10 when touched by a player
- end
- end)
- -- Update pet display
- while true do
- wait(1) -- Update once per second
- print("Pet Name: " .. petName)
- print("Pet Health: " .. petCurrentHealth .. "/" .. petMaxHealth)
- end
Advertisement
Comments
-
- Hey I got a way you can run ads on pastes & earn extra money. I run a site called BloxyBin . (com), if you want more information my Discord is Medusa#1461 or checkout the site.
- Also since you make your own scripts I think its important to mention, I have a pre-built key unlock system you can hook your script into for secure timed key generation & you can earn money off ads ran on the site.
Add Comment
Please, Sign In to add comment
Advertisement