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
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
| |
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
| |
|
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
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 23 Oct 2011 09:50 AM |
| Thanks, i feel stupid now, lol. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 23 Oct 2011 10:08 AM |
| Just add another elseif above the else. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 23 Oct 2011 11:20 AM |
| Oh I always thought EOF Means End Of Function.. |
|
|
| Report Abuse |
|
|