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

Swords not doing damage?

r = game:GetService("RunService") 
ching = false 
sword = script.Parent.Handle 
Tool = script.Parent 
script.Parent.ToolTip = "Base damage: " .. script.Parent.MinDmg.Value .. "-" .. script.Parent.MaxDmg.Value .. " | Critical damage: " .. (script.Parent.CritMagnitude.Value/100).. "x"

function blow(hit) 
if ching == true then return end 
	local humanoid = hit.Parent:FindFirstChild("Human") 
	local vCharacter = game.Players.LocalPlayer.Character
	local vPlayer = game.Players.LocalPlayer
	if humanoid~=nil then 
		ching = true 
		--print("SWORD HIT") 
		tagHumanoid(humanoid, vPlayer) 
		local damage = math.random(script.Parent.MinDmg.Value+math.floor(vPlayer.attributes.Strength.Value/2),script.Parent.MaxDmg.Value+math.floor(vPlayer.attributes.Strength.Value/2))+math.floor(vPlayer.leaderstats.Lvl.Value/5)
		local hitroll = math.random(1, 100)
		local critroll = math.random(1, 100)
		--Hit and critical modifier.
		if hitroll > Game.Workspace.GAME_PROPERTIES.BaseHitChance.Value + (vPlayer.attributes.Dexterity.Value * (Game.Workspace.GAME_PROPERTIES.HitChanceDexMagnitude.Value/100)) then
			damage = 0
		end
		if critroll <= Game.Workspace.GAME_PROPERTIES.BaseCritChance.Value + (vPlayer.attributes.Dexterity.Value * (Game.Workspace.GAME_PROPERTIES.CritChanceDexMagnitude.Value/100)) then
			damage = damage * (script.Parent.CritMagnitude.Value / 100) -- Percentage.
		end
		--Enemy health bar GUI
		if vPlayer.PlayerGui:FindFirstChild("EnemyInfo") ~= nil and humanoid.Health > 0 then
			vPlayer.PlayerGui:FindFirstChild("EnemyInfo").EnemyBar.TickUntilRemove.Value = 75
		else
			GUI = Game.ReplicatedStorage.EnemyInfo:Clone()
			GUI.EnemyBar.Tag.Value = humanoid.Parent
			GUI.Parent = vPlayer.PlayerGui
		end
		--Damages humanoid
		humanoid:TakeDamage(damage) 
		--Floating damage text
		local part = Instance.new("BillboardGui")
		part.Size = UDim2.new(0,50,0,100) 
		part.StudsOffset = Vector3.new(0,2,0)
		local part2 = Instance.new("TextLabel") 
		dt = Game.ReplicatedStorage.DynamicText:Clone()
		part2.Font = "SourceSansBold"
		part2.FontSize = "Size24"
		part2.TextStrokeTransparency = 0
		part2.Size = UDim2.new(1,0,1,0) 
		part2.Position = UDim2.new(0,0,0,0) 
		part2.BackgroundTransparency = 1
		part2.Parent = part 
		dt.Parent = part2
		dt.Disabled = false
		part.Parent = humanoid.Parent.Head
		part.Adornee = part.Parent
		--Shows text depending on conditions. Tells either miss or number.
		if (damage == 0) then 
			part2.TextColor3 = Color3.new(0,0.5,1)
			part2.Text = "Miss!"
		else 
			part2.TextColor3 = Color3.new(1,1,1)
			if critroll <= Game.Workspace.GAME_PROPERTIES.BaseCritChance.Value + (vPlayer.attributes.Dexterity.Value * (Game.Workspace.GAME_PROPERTIES.CritChanceDexMagnitude.Value/100)) then
				part2.TextColor3 = Color3.new(1,1,0)
				part2.FontSize = "Size36"
				part2.Text = ""..damage.."!"
			else
				part2.Text = ""..damage..""
			end
		end 
		wait(.75) 
		ching = false 
		wait(.1) 
		untagHumanoid(humanoid) 
	end 
end 

Line 28 Stack end Disconnected because of exception

Yes this is a local script.

1 answer

Change the = into ==

When COMPARING values you use ==

one = is for setting them.

Though i have no idea what Tickuntilre is so..... yeah.

2 comments

0

When I do that, it gets underlined red saying "'=' expected near '=='" And tick Until Remove is how much time till the GUI is removed

0

Is it a function? or a variable? if it's a variable make it "repeat wait() until tickuntilre == 75"

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