generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Damage with deepness.

Previous Thread :: Next Thread 
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 04:46 AM
How to damage with deepness?
Please write down the whole script. For example when player Y position is under 0 then he taking damage.
Report Abuse
UgOsMiLy is not online. UgOsMiLy
Joined: 15 Sep 2009
Total Posts: 2095
31 Oct 2013 05:27 AM
maybe something that is under the y axis (a brick) that puts something inside the character and damages its health by ___ ...

1.Get a brick.
2.Put this inside

function onTouched(part)
part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - 1 -- change 1
--to how much damage you want to do
end
script.Parent.Touched:connect(onTouched)

3.Make it's position 32, -274.71, -172
4. and the size 1216, 550.6, 1550
Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 05:32 AM
Okay I want to make a drowning script. If the player is inside the Baseplate(this is the water) then he taking damage.
Report Abuse
4444vince2 is not online. 4444vince2
Joined: 08 Nov 2008
Total Posts: 4880
31 Oct 2013 05:39 AM
You could use a ontouch script or make players take damage if there Position is under a certain depth.
Report Abuse
Speedhax4r is not online. Speedhax4r
Joined: 26 Jun 2012
Total Posts: 81
31 Oct 2013 05:39 AM
dmg = 1 --Type how much damage you want to give the person
script.Parent.Touched:connect(function(hit)
if hit.Parent.ClassName == "Model" and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(dmg)
end
end)
Report Abuse
Speedhax4r is not online. Speedhax4r
Joined: 26 Jun 2012
Total Posts: 81
31 Oct 2013 05:40 AM
Put the script that I gave you in the water
Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 05:49 AM
I want only hurt the player when he is underwater or if his Y position <0
Report Abuse
Speedhax4r is not online. Speedhax4r
Joined: 26 Jun 2012
Total Posts: 81
31 Oct 2013 05:57 AM
dmg = 1 --Type how much damage you want to give them
while wait() do
for k,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("Character") then
if v.Character.Torso<3 then --don't change the 3 if you do it will hurt forever
v.Character.Humanoid.Health = v.Character.Humanoid.Health - dmg
end
end
end
end
Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 06:03 AM
Put it into the baseplate(this is the water)
Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 06:08 AM
?
Report Abuse
BenBonez is not online. BenBonez
Joined: 29 Aug 2008
Total Posts: 19362
31 Oct 2013 06:12 AM
Paste this in a LocalScript and place it in the StarterGui:

local height = 0 -- Y height of your water
local damage = 1 -- amount of damage to be dealt each interval
local interval = 0.5 -- in seconds

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local head = character:WaitForChild("Head")

while true do
if head.Position.Y < height then
humanoid:TakeDamage(damage)
end
wait(interval)
end
Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 06:21 AM
Thanks BenBonez its working. Another question. How can I stop auto-regenerating health. And my LAST question is: how can I make a lifejacket thats only activated when the player position is under 0. (I have a BodyPosition in my lifejacket and when the player position >0 maxFroce=0)
Report Abuse
BenBonez is not online. BenBonez
Joined: 29 Aug 2008
Total Posts: 19362
31 Oct 2013 06:27 AM
To stop Health regen paste this in a LocalScript and place it in StarterGui:

repeat wait() until game.Players.LocalPlayer.Character
game.Players.LocalPlayer.Character:WaitForChild("Health"):Destroy()


For the lifejacket use part of the original script.
I have no experience with Body objects but I think a BodyForce will work just fine you might need to play with the value to get it right though:

local height = 0 -- Y height of your water

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local head = character:WaitForChild("Head")

while true do
if head.Position.Y < height then
local jacket = Instance.new("BodyForce", character.Torso)
jacket.force = Vector3.new(0,100,0) -- 100 is the value to adjust
break
end
wait(0.5)
end

Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 06:33 AM
Thanks everything. The really LAST question is how to make a button that only can use by VIPs
Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 06:39 AM
One problem with the LifeJacket. If you jump in the water then it will launch you to the sky xD
Report Abuse
Humorcet is not online. Humorcet
Joined: 17 Aug 2013
Total Posts: 412
31 Oct 2013 06:57 AM
And I also want to make underwater fog but I dont know how.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image