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
 

Re: What's wrong with this?

Previous Thread :: Next Thread 
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
29 Nov 2012 08:49 PM
20:45:22 - Workspace.LosePointsOnDeath:16: 'end' expected (to close 'if' at line 12) near 'else'



LoseAmount = 50
coolpeopleLoseAmount = LoseAmount/2
epicpeopleLoseAmount = 0

local Players = Game:GetService("Players")
Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Died:connect(function()
if Game:GetService("GamePassService"):PlayerHasPass(Player, 978978) then return end
if Game:GetService("GamePassService"):PlayerHasPass(Player, 343469) then
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - coolpeopleLoseAmount
else
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - epicpeopleLoseAmount
else
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - LoseAmount
end
end)
end
end)
end)
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
29 Nov 2012 08:53 PM
You need an end to close line 12... o.O Meaning, you don't have enough ends.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
29 Nov 2012 08:55 PM
Would it be like end or end)?
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
29 Nov 2012 09:00 PM
Actually, with the first end), erase the ). You only have 2 anonymous functions, and 3 if loops. So it should be:

end
end
end
end)
end)

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
29 Nov 2012 09:05 PM
Still get that same error.

21:04:53 - Workspace.LosePointsOnDeath:16: 'end' expected (to close 'if' at line 12) near 'else'
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
29 Nov 2012 09:06 PM
Is there more to the script? I don't see why it still needs to close.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
29 Nov 2012 09:07 PM
That's it.
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
29 Nov 2012 09:07 PM
Whoa whoa whoa, wait.... I just saw that there is another anonymous function in the first if statement. It should go like this:
end
end
end)
end
end)
end)

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
29 Nov 2012 09:11 PM
I still get the error.
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
29 Nov 2012 09:15 PM
I don't get why its not working o.o Edit the script a little bit.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
29 Nov 2012 09:27 PM
You're telling me to edit the script, what do you think I'm trying to do?
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
30 Nov 2012 02:14 PM
I think you are trying to create where if a player has a certain gamepass, when they die, they only lose a certain amount of points.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
bonkertje123 is not online. bonkertje123
Joined: 26 Dec 2011
Total Posts: 1642
30 Nov 2012 02:27 PM
Is it a local script?
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
30 Nov 2012 04:07 PM
@Jonah

Yes, that's exactly what I'm trying to do.

@Bonk

No.
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 04:21 PM
If you look near the bottom of your code, you are actually using to else's in a row, which is incorrect.
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 04:21 PM
two*
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
30 Nov 2012 04:34 PM
Oh yeah... xD Why didn't I catch that? You can only use else once because else works around the if/elseif statements. Use elseif.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
30 Nov 2012 04:36 PM
Can you put it in the script so I can see it?
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 04:37 PM
if Game:GetService("GamePassService"):PlayerHasPass(Player, 343469) then
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - coolpeopleLoseAmount
elseif nepicpeoplegamepass?
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - epicpeopleLoseAmount
elseif nogamepass?
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - LoseAmount
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
30 Nov 2012 05:11 PM
...
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
30 Nov 2012 05:18 PM
LoseAmount = 50
coolpeopleLoseAmount = LoseAmount/2
epicpeopleLoseAmount = 0

local Players = Game:GetService("Players")
Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Died:connect(function()
if Game:GetService("GamePassService"):PlayerHasPass(Player, 978978) then return end
elseif Game:GetService("GamePassService"):PlayerHasPass(Player, 343469) then
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - coolpeopleLoseAmount
elseif Game:GetService("GamePassService"):PlayerHasPass(Player, [Gampass #]) then
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - epicpeopleLoseAmount
else
Player.leaderstats.XP.Value = Player.leaderstats.XP.Value - LoseAmount
end
end
end)
end)

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
30 Nov 2012 05:49 PM
17:48:10 - Workspace.LosePointsonDeath:12: 'end' expected (to close 'function' at line 10) near 'elseif'
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
30 Nov 2012 09:10 PM
I don't really understand your script enough to rewrite it correctly... Although, use elseif like you would as an if statement. elseif gives an exception to the if statement like...

if part.Transparency = 0 then
print("It's 0 Visible! Just what I thought!")
elseif part.Transparency = 0.1 then
print("It's Slightly invisible... I was close though!")
else
print("Nope, you weren't close at all.")
end

On your script, you just need to rewrite it so that once you have if --player has gamepass etc... then,
you put elseif with all the other gamepasses, until there isn't anymore gamepasses left. Then, have else as normal players, that doesn't have gamepasses.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
30 Nov 2012 09:22 PM
Just stop trying to help. You aren't helping at all. You tried like 5 times and keep changing what you say about the script. Just stop it.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
30 Nov 2012 09:23 PM
Change the first elseif in Jonah's script to an if. The other if already has an end.

¤¤ †KMXD† ¤¤
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