Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my wait seem to not work while being used in a script?

=Problem= i put 1 print before and after a wait the 1st one prints but the one after the print does not print well after the wait i try using wait() it seems to woerk, i have waits in other scrips but they do not work, no output errors

=Script=

deb = script:FindFirstChild('Deb')
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=713970194"
animTrack = script.Parent.Parent.Parent.Parent.Humanoid:LoadAnimation(animation)
local disabler = script.Parent:FindFirstChild('Disabler'):Clone()

function onDamage(Part)
		local Val2 = Part.Parent:FindFirstChild("Humanoid") or Part.Parent.Parent:FindFirstChild("Humanoid")
	
	print('fired')
    if Val2 ~=nil and script.Parent.Parent.Parent.Parent.Swinging.Value == true and deb.Value == false  then
	print('negados')
		deb.Value = true
		local Val = Part.Parent:FindFirstChild("Blocking") or Part.Parent.Parent:FindFirstChild("Blocking")
		local Val3 = Part.Parent:FindFirstChild("Swinging") or Part.Parent.Parent:FindFirstChild("Swinging")
		local uno = 1

		if Val and Val.Value == true then
			animTrack:Play()			
			Val.Value = false
			disabler.Parent = Val
			disabler.Disabled = false
			print(543141343) -- prints
			wait(.5) -- tried adding another wait same results
			print('asadas') -- does not print
			deb.Value = false	
		elseif Val3 and Val3.Value == true then
			animTrack:Play()			
			Val3.Value = false
			disabler.Parent = Val3
			disabler.Disabled = false
			wait(.5)	
			deb.Value = false		
		else	
			Val2:TakeDamage(script:WaitForChild('Damage').Value)
			wait(.5)
			deb.Value = false

		end
    end
end
script.Parent.Touched:connect(onDamage)

1 answer

I don't know the entire script but, chances are that you need to add a wait in front so this would probably work:

wait(1)
print("What you want to print")
wait(2)
print("What you want to print")

If that doesn't work then post the entire script so I can take a look

2 comments

0

that did not work, i posted the entire script

0

Well to be honest you need a function in order for it to work

This discussion is preserved as it was. New answers, comments, and votes are closed.