generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: WTF

Previous Thread :: Next Thread 
aaront2000 is not online. aaront2000
Joined: 27 Oct 2009
Total Posts: 189
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
TheIceZombieSlayer is not online. TheIceZombieSlayer
Joined: 26 Mar 2013
Total Posts: 267
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
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
23 Aug 2016 02:22 PM
^
Report Abuse
aaront2000 is not online. aaront2000
Joined: 27 Oct 2009
Total Posts: 189
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
TheIceZombieSlayer is not online. TheIceZombieSlayer
Joined: 26 Mar 2013
Total Posts: 267
23 Aug 2016 02:23 PM
Don't put it after else, put it where it needs to go.
Report Abuse
aaront2000 is not online. aaront2000
Joined: 27 Oct 2009
Total Posts: 189
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image