#Basic scripting help (with wait)
159 messages · Page 1 of 1 (latest)
How do I do that?
With debounce.
https://create.roblox.com/docs/scripting/scripts/debounce
local Part = script.Parent
local db = false
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
if debounce == false then
debounce = true
hit.Parent.Health = hit.Parent.Health -= 10
wait(1)
debounce = false
end
end)
What even is a debounce?
Debounce is just an cooldown.
I don't really know how to explain it, that it is just an cooldown.
Oh ok
Yeah
Could you explain that code a little more so I can do it in future without just copying
A cool-down
So it pauses between each hit
So basically
It’s a Boolean variable (true or false)
I added the debounce link that you can go through.
you may just read it in the documetation.
Oh ok
Well it isn't doing any dmg now
What are the errors?
I may do a mistake since im literally coding on discord.
ah i forgot smth.
lemme fix mistakes.
k
Show the code right now
It says you are forgetting quotations in a string I believe
local Part = script.Parent
local db = false
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
if db == false then
db = true
hit.Parent.Health = hit.Parent.Health - 10
wait(1)
debounce = false
end
end)
here, i made it
How do you make it like that on discord?
Delete humanoid and rewrite it again
Instead of just text
i cleared out the mistakes, i forgot about the variable.
i get why it wont work
Rewrite “Humanoid”
lua
i may think.
woah
the code i copied from was:
And also change local db to debounce
Did I spell wrong?
he may did some mistakes.
No just rewrite it
local Part = script.Parent
local db = false
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if db == false then
db = true
hit.Parent.Health = hit.Parent.Health - 10
wait(1)
debounce = false
end
end)
** You are now Level 1! **
The strings for Humanoid must be " ".
Or else roblox studio wont just really get it.
@toxic basin
The strings are used wrong.
Rewrite “Humanoid”
I just did
He needs to rewrite it so it’s green
When you copy and paste sometimes the strings don’t register properly
Just trust me
Mine works when it isn't green
The strings are supposed to be " " im sure.
Mine is just different colors for that idk why
local Part = script.Parent
local db = false
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if db == false then
db = true
hit.Parent.Health = hit.Parent.Health - 10
wait(1)
db = false
end
end)
local debounce = false
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
if debounce == false then
debounce = true
hit.Parent.Health = hit.Parent.Health - 10
wait(1)
debounce = false
end
end)```
That's the code
However, just copy this code.
And wait for the results.
You used “ ”.
Try the script now
Which is wrong.
Still doesn't do dmg
Ah. i forgot
Oh
It is hard to code on discord..
Agreed
local Part = script.Parent
local debounce = false
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
if debounce == false then
debounce = true
hit.Parent.Health = hit.Parent.Health - 10
wait(1)
debounce = false
end
end
end)
I’m so used to it auto filling for me
Very true.
Why doesn't it anymore?
@toxic basin
Here, i fully wrote them in roblox studio.
local Part = script.Parent
local db = false
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if db == false then
db = true
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
task.wait(1)
db = false
end
end
end)
Hm, i think that may be correct.
You fixed it 🫡
Cool.
How did we go through 117 messages and this guy comes in here first try lmao
How did you do it mr. smile face
Coding
Devforum, and the Roblox's official scripting website. which Max1 sent.
Ok thank you so much
Well, the link.
Ah, wait.
Also a tip.
On roblox studio, press F1.
It brings you to the roblox tutorial website.
Ah ok
which includes scripting and debounces about this post topic!
Thank you, I am really trying to become a coder but it has been a struggle for me
I don't know how some people pick it up so easily lol
No problem, i hope you'll get there soon.
Do you have any other tips?
I never watched youtube scripting tutorials, but you can get a hand on them.
That's what I did and didn't seem to get very far with them 🤷♂️
To even increase your skills, you should use your imagination and pratice what it takes for.
The goal is the progression.
What?
A little bit irrelative there, but.
Sorry I am just wondering lol
It is a little bit understandable, i dont know that much about that game but its just their skills are BIG, i guess.
A little pun over there, haha..
Well, good day.
I see what you did lol
Haha yeah, i'll see you soon.
Cya