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 » Scripting Helpers
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 09:44 AM
Output:
Workspace.Headspawn.Script:19: 'end' expected (to close 'function' at line 1) near '< eof >'


This is the script:
function onTouch(hit)
if hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=37152069") then -- Put the link in the quotes
a = game.Lighting:FindFirstChild("Cursed Mummy friend"):clone()
a.Parent = hit.Parent -- There was "and" here?!?
b = game.Lighting:FindFirstChild("Khopesh"):clone()
b.Parent = hit.Parent
else
if hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=27112438") then -- Robloxian 2.0
c = game.Lighting:FindFirstChild("LinkedDagger"):clone()
c.Parent = hit.Parent
else
if hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=32332055") then -- Gunslinger
d = game.Lighting:FindFirstChild("Gunslinger Rifle"):clone()
d.Parent = hit.Parent
end
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
1WOOF1 is not online. 1WOOF1
Joined: 03 May 2009
Total Posts: 20682
23 Oct 2011 09:47 AM
[ Content Deleted ]
Report Abuse
Apocalyps is not online. Apocalyps
Joined: 15 Feb 2009
Total Posts: 816
23 Oct 2011 09:49 AM
eof == End Of File
Report Abuse
eSvena is not online. eSvena
Joined: 11 Aug 2011
Total Posts: 75
23 Oct 2011 09:49 AM
When you put else, you have to put a end front of it. I think you wanted to do that : elseif. just remplace :

else
if

by

elseif ( without space between else and if )

And remove just one end.
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 09:50 AM
Thanks, i feel stupid now, lol.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
23 Oct 2011 09:50 AM
eof means end of file,AKA you have the wrong number of ends

function onTouch(hit)
if hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=37152069") then -- Put the link in the quotes
a = game.Lighting:FindFirstChild("Cursed Mummy friend"):clone()
a.Parent = hit.Parent -- There was "and" here?!?
b = game.Lighting:FindFirstChild("Khopesh"):clone()
b.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=27112438") then -- Robloxian 2.0
c = game.Lighting:FindFirstChild("LinkedDagger"):clone()
c.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=32332055") then -- Gunslinger
d = game.Lighting:FindFirstChild("Gunslinger Rifle"):clone()
d.Parent = hit.Parent
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 09:59 AM
I added another "end" but I got this output:
Workspace.Headspawn.Script:15: '< eof >' expected near 'end'

After many ends I ended up with this:

function onTouch(hit)
if hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=37152069") then -- Put the link in the quotes
a = game.Lighting:FindFirstChild("Cursed Mummy friend"):clone()
a.Parent = hit.Parent -- There was "and" here?!?
b = game.Lighting:FindFirstChild("Khopesh"):clone()
b.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=27112438") then
c = game.Lighting:FindFirstChild("LinkedDagger"):clone()
c.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("http://www.roblox.com/asset/?id=32332055") then
d = game.Lighting:FindFirstChild("Gunslinger Rifle"):clone()
d.Parent = hit.Parent
end -- Don't forget the end alert!!
end
end
end
script.Parent.Touched:connect(onTouch)
end
end
end
end

And I STILL get the same output.
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 10:02 AM
@Sduke
It worked! Thanks man! Now, if i wanted to add an "e" variable in there next, would i add 1 more end, or more?
Report Abuse
eSvena is not online. eSvena
Joined: 11 Aug 2011
Total Posts: 75
23 Oct 2011 10:04 AM
Take Sduke524's fixed script.

if (condition) then
elseif (condition) then
elseif (condition) then
else

end

This serie of conditions need just one end because you add a else but you can do that :

if (condition) thene
end

if (condition) then
end

if (condition) then
end

...
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
23 Oct 2011 10:08 AM
Just add another elseif above the else.
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 10:11 AM
I'll use Sdukes, if that doesn't work ill use yours.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
23 Oct 2011 10:14 AM
@eSvena

You can do it the way he does it, just it's ugly

if (condition) then
...
else
if (condtion2) then
...
else
if (condition3) then
...
else
if (condition4) then
...
else
...
end end end end


I've seen it have to be done lots of times when people didn't realize that it was elseif and not else if.
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 11:19 AM
On the out put it says it works, but when i play it it wont. I'm confused.
Report Abuse
bikerking300 is not online. bikerking300
Joined: 31 Mar 2010
Total Posts: 1034
23 Oct 2011 11:20 AM
Oh I always thought EOF Means End Of Function..
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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