|
| 23 Aug 2016 02:19 PM |
Script in an enemy's torso
local headclone = script:clone() headclone.Parent = script.Parent.Parent.Head local torsoclone = script:clone() torsoclone.Parent = script.Parent.Parent.Torso local headclone = script:clone() headclone.Parent = script.Parent.Parent["Left Arm"] local headclone = script:clone() headclone.Parent = script.Parent.Parent["Left Leg"] local headclone = script:clone() headclone.Parent = script.Parent.Parent["Right Arm"] local headclone = script:clone() headclone.Parent = script.Parent.Parent["Right Leg"]
function touch(hit) local hum = hit.Parent:FindFirstChild("Humanoid") if hum then local play = game.Players:GetPlayerFromCharacter(hit.Parent) if play then hit.BrickColor = BrickColor.new(Color3.new(0,0,0)) end wait(5) hit:BreakJoints() wait(5) hit:destroy() end else if hit.Locked == false then hit.BrickColor = BrickColor.new(Color3.new(0,0,0)) for i=1, 25 do wait(0.1) hit.Reflectance = 1 wait(0.1) hit.Reflectance = 0 end hit:BreakJoints() hit.Anchored = false wait(5) hit:destroy() end end end
script.Parent.Touched:connect(touch)
15:14:44.615 - Workspace.Lightning Enemy.Torso.Electric:27: 'end' expected (to close 'function' at line 15) near 'else'
I looked it over multiple times and don't see anything wrong with it. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2016 02:20 PM |
Add an 'end' to close the function at line 15 near 'else'.
The output is telling you exactly what to do. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Aug 2016 02:22 PM |
I put an end after else, and it didn't do anything, it still says this
15:21:45.443 - Workspace.Lightning aaront2000.Torso.Electric:27: 'end' expected (to close 'function' at line 15) near 'else' |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2016 02:23 PM |
| Don't put it after else, put it where it needs to go. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2016 02:26 PM |
I rearranged it like this
function touch(hit) local hum = hit.Parent:FindFirstChild("Humanoid") if hum then local play = game.Players:GetPlayerFromCharacter(hit.Parent) if play then hit.BrickColor = BrickColor.new(Color3.new(0,0,0)) end wait(5) hit:BreakJoints() wait(5) hit:destroy() else if hit.Locked == false then hit.BrickColor = BrickColor.new(Color3.new(0,0,0)) for i=1, 25 do wait(0.1) hit.Reflectance = 1 wait(0.1) hit.Reflectance = 0 end hit:BreakJoints() hit.Anchored = false wait(5) hit:destroy() end end end
script.Parent.Touched:connect(touch)
and it worked... Because that was obvious -_- |
|
|
| Report Abuse |
|
|