basicaly i have a bootvalue in one of the scripts when i press F it gets buffed and bootvauled sets to true then in another script it checks if value is true if it is it should buff the damage if its false then damage should be normal but it doesnt works help?
heres the script
///////////////////////////////
local tool = script.Parent.Parent local Blade = tool:WaitForChild("Blade") local Particle1 = Blade:WaitForChild("Lightning1") local Buffed = tool:WaitForChild("Buffed") tool:FindFirstChild("Buffed") Buffed.Changed:Connect(function() if Buffed.Value == true then wait(1) local debounce = false local HealthLoss = 100 function OnTouched(Part) if Part.Parent ~= nil then if debounce == false and Part.Parent:findFirstChild("Humanoid") ~= nil then debounce = true Part.Parent:findFirstChild("Humanoid"):TakeDamage(HealthLoss) wait(0.4) debounce = false wait(1) end end end end end) tool:FindFirstChild("Buffed") if Buffed.Value == false then local debounce = false wait(1) local HealthLoss = 50 function OnTouched(Part) if Part.Parent ~= nil then if debounce == false and Part.Parent:findFirstChild("Humanoid") ~= nil then debounce = true Part.Parent:findFirstChild("Humanoid"):TakeDamage(HealthLoss) wait(0.4) debounce = false end end end Buffed.Value = false end script.Parent.Touched:connect(OnTouched)
////////////////////////////
Well I found some possible problems:
1) You do not need lines 5 and 29
2) On lines 15, 18, 38, and 40, you have :findFirstChild()
instead of :FindFirstChild
. Unfortunately, Lua is really touch-sensitive, so those 4 lines will not work.
Edit:
Ok, so I revised your script, this should work (if you need me to explain any of it, please tell me):
local tool = script.Parent.Parent local Blade = tool:WaitForChild("Blade") local Particle1 = Blade:WaitForChild("Lightning1") local Buffed = tool:WaitForChild("Buffed") Buffed.Changed:Connect(function() if Buffed.Value == true then wait(1) debounce = false HealthLoss = 100 elseif Buffed.Value == false then debounce = false wait(1) HealthLoss = 50 end Buffed.Value = false end) function OnTouched(Part) if Part.Parent ~= nil then if debounce == false and Part.Parent:findFirstChild("Humanoid") ~= nil then debounce = true Part.Parent:findFirstChild("Humanoid"):TakeDamage(HealthLoss) debounce = false wait(1) end end end) script.Parent.Touched:Connect(OnTouched)