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

So i am making a Double Sword, and i'm having trouble with making it damage?

My Code for the animation player - l~~~~~~~~~~~~~~~~~ ocal CanDamage = script.Parent.Parent.Values.CanDamage local SoundPlayed = script.Parent.Parent.Values.SoundPlayed

function reRoll()

local randomPick = math.random(1, #exTable) local exValue = exTable[randomPick] return exValue end

tool.Activated:Connect(function() CanDamage.Value = true if debounceTrue == false then debounceTrue = true local exValue = reRoll() if exValue ~= lastValue then lastValue = exValue local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://"..exValue local animTrack = humanoid:LoadAnimation(Animation) animTrack:Play() wait(debounceTime) debounceTrue = false elseif exValue == lastValue then print("[ERROR] "..exValue.." was already rolled. Rerolling.") repeat exValue = reRoll() until exValue ~= lastValue lastValue = exValue local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://"..exValue SoundPlayed.Value = true local animTrack = humanoid:LoadAnimation(Animation) animTrack:Play() wait(debounceTime) debounceTrue = false end end end)




The code for the damager - 

l~~~~~~~~~~~~~~~~~
ocal CanDamage = script.Parent.Parent:WaitForChild("Values").CanDamage
local Check = true
local Damage = script.Parent.Parent.Values.Damage
local Blade1 = script.Parent.Parent.Union
local Blade2 = script.Parent.Parent.Union2
local Blades = Blade1 or Blade2

Blades.Touched:Connect(function(t)
	local Humanoid = t.Parent:FindFirstChild("Humanoid")
	if Check == true and Humanoid then
		if CanDamage.Value == true then
			CanDamage.Value = false
			Check = false
			Humanoid.Health = Humanoid.Health - Damage.Value
			wait(0.1)
			Check = true
		end
	end
end)

2 comments

0

why are you putting so many ~ aka not equal signs?

0

and put it all in a code block it's so hard to read

1 answer

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