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

i figured out how to do this now last time i swear how?

CanDoDmg = true
dmg = 15
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse() 

KeyBind = "e"


mouse.Keydown:Connect(function(Key)
	if Key == KeyBind then
		local anim = script.Parent.Humanoid:LoadAnimation(script.Animation)
		anim:play()
script.Parent.RightHand.Touched:Connect(function(hit)
			if hit.Parent.Humanoid:TakeDamage(dmg)
				CanDoDmg = false -- says this is wrong
				wait(1)
				CanDoDmg = true			
           end)
		end
	end)
end
-- this is the error message Players.dogedaily9000.PlayerScripts.LocalScript:15: Expected 'then' when parsing if statement, got 'CanDoDmg'

2 comments

0

i just found out i can edit it

0

btw this is a puch script

1 answer

Syntax error at line 14, If statements are paired with the reserved keyword then.

Sample: Using an if statement with the reserved keyword then so the script can work:

local a = true

if a then
	print'variable a is true'
end

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