I cannot understand why my sword is not slashing I am using the tutorial that Stickmasterluke has provided and I'm stuck trying to create this sword ? The Error = Error: (40,17) Expected identifier, got ') I am on the Mad Bloxxer 6: Script the Sword, Pt. 2 (ROBLOX U Tutorial)
-- Made by Rualmoneyman567 tool = script.Parent local speedboost = 1.35 local damage = 26 local swingtime = 2 local handle = tool:WaitForChild("Handle") local event = tool:WaitForChild("RemoteEvent") local lastclick = tick() handle.Touched:connect(function(hit) if equiupped and character and humanoid and humanoid.Health > 0 and not hit and hit:IsDesecendantOf(character) then local targethumnoid = hit.Parent:FindFirstChild("Humanoid") if targethumanoid and targethumanoid.Health > 0 then hithumanoids[targethumanoid] = true targethumnoid:TakeDamage(damage) end end end) tool.Activated:connect(function() local clickdelta = tick() - lastclick if clickdelta > swingtime then lastclick = tick() hithumanoid = () end end) tool.Equipped:connect(function() equipped = true lastclick = tick() character = tool.Parent player = game.Players:GetPlayerFromCharacter(character) humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.WalkSpeed = humanoid.WalkSpeed * speedboost else character = nil end end) tool.Unequipped:connect(function() equipped = false if humanoid then humanoid.WalkSpeed = humanoid.WalkSpeed / speedboost end character = nil humanoid = nil end)
The error i get is Error: (40,17) Expected identifier, got ')'
The error message is telling you that you have a syntax error. If you open up the Script Analysis window in Roblox Studio, it will be able to tell you about that type of error before you even run the script.
In this case, it's saying that there's something wrong on line 40:
hithumanoid = ()
Indeed, that's not a valid line. "()" doesn't mean anything. I am guessing it should be "nil" instead, though I don't see the variable used anywhere else in the script (from what you've shown). I see a "hithumanoids" table, which could be reset using "hithumanoids = {}".