Advertisement
DaDogeDevelopment

Simple script for a PSX type roblox game

Apr 13th, 2023
103
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. Simple script for a PSX type roblox game
  2.  
  3. -- Define pet properties
  4. local pet = script.Parent
  5. local petName = "My Pet"
  6. local petMaxHealth = 100
  7. local petCurrentHealth = petMaxHealth
  8.  
  9. -- Define pet functions
  10. function takeDamage(damageAmount)
  11.     petCurrentHealth = petCurrentHealth - damageAmount
  12.     if petCurrentHealth <= 0 then
  13.         pet:Destroy() -- Destroy the pet when its health reaches 0
  14.     end
  15. end
  16.  
  17. function heal(healAmount)
  18.     petCurrentHealth = math.min(petCurrentHealth + healAmount, petMaxHealth) -- Clamp health to max health
  19. end
  20.  
  21. -- Connect pet functions to events
  22. pet.Touched:Connect(function(hit)
  23.     local part = hit.Parent
  24.     local humanoid = part:FindFirstChild("Humanoid")
  25.     if humanoid then
  26.         takeDamage(10) -- Reduce pet's health by 10 when touched by a player
  27.     end
  28. end)
  29.  
  30. -- Update pet display
  31. while true do
  32.     wait(1) -- Update once per second
  33.     print("Pet Name: " .. petName)
  34.     print("Pet Health: " .. petCurrentHealth .. "/" .. petMaxHealth)
  35. end
  36.  
Advertisement
Comments
  • Medusa_
    2 years
    # text 0.39 KB | 1 0
    1. 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.
    2.  
    3. 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