EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
Hello, I'm not new to scripting and I've learnt a lot and I've tried and tried with different types of code in different ways but for some reason I just haven't figured it out idk if I'm being dumb rn because I've been up all night to be fair but anyway what I'm trying to figure out is if you're touching a block it will slowly take away health like every two seconds or so I know this is a VERY simple script and I may look like a noob rn but I have been trying to figure this out for like three hours now and I don't know why I cannot figure it out!! any help is appreciated...
|
|
EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
I need help immediately
|
|
|
meybe you should make script that hurt thr player and wait 2 sec. before hurt again !!!
|
|
ReapqrJoin Date: 2017-01-27 Post Count: 921 |
Did you use lowertorso or just torso in the script? |
|
EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
that's the idea only I cant do really simple scripts like
Health = 99
wait (2)
Health = 98
wait (2)
because otherwise it glitches and sets it to 99 93 92 58 12 99 randomly
|
|
EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
its the health... health is in humanoid... why would you use the torso
|
|
ReapqrJoin Date: 2017-01-27 Post Count: 921 |
Try this...
script.Parent.Touched:connect(function(hit)
pcall(function()
hit.Parent.Humanoid:TakeDamage(5)
end)
end)
I don't know if this works. Have not tried it. |
|
|
Maybe you mustn't change nuber of health but you can decrease a nuber of health by 1 HP ? |
|
|
yes / take damage = decrease health :D |
|
EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
it just instantly kills
|
|
EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
its going to be a storm and the health slowly decreases and decreases
|
|
ReapqrJoin Date: 2017-01-27 Post Count: 921 |
isOff = true
function die(part)
if part.Parent:findFirstChild("Humanoid") ~- nil and isOff == true then
isOff = false
for 1, 25 do
part.Parent:findFirstChild("Humanoid").Health = part.Parent:findFirstChild("Humanoid").Health - 1
end
wait(4)
isOff = true
end
end
script.Parent.Touched:connect(die) |
|
ReapqrJoin Date: 2017-01-27 Post Count: 921 |
Or this
function touch(hit)
hum = hit.Parent:FindFirstChild("Humanoid")
if hum ~= nil then
hum:TakeDamage(10)--change this
end
end
script.Parent.Touched:connect(touch) |
|
EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
it just takes it down a bit once
|
|
ReapqrJoin Date: 2017-01-27 Post Count: 921 |
Then I'm not sure... |
|
EmbolicalJoin Date: 2016-07-13 Post Count: 26 |
ill probs just wait until later when I've had a sleep lol probs why I can't think of anything thanks for the help though
|
|
|
maybe use wait comand :
wait(2) |
|