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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Not Working in Filtering Enabled

Previous Thread :: Next Thread 
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 03:11 PM
function declareLoser()
local winners = ""
local players = game:GetService("Players"):GetPlayers();
local msg = Instance.new("Message", game:GetService("Workspace"));
msg.Text = owner.Value.Name.." was the loser!";
wait(2);
msg:Destroy();
if players["Character"]:findFirstChild("Alive") ~= nil then
winners = winners.." "..players.Name..""
if players:findFirstChild("leaderstats") ~= nil then
players.leaderstats.Wins.Value = players.leaderstats.Wins.Value + 1
end
end
end;
Report Abuse
iPenguinSuperTime is not online. iPenguinSuperTime
Joined: 25 Apr 2012
Total Posts: 3757
30 Jan 2016 03:15 PM
Yeah you have to do remotefunctions/events if you're going to use FE otherwise it won't work.

http://wiki.roblox.com/index.php?title=API:Class/RemoteFunction
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 03:16 PM
It works on FE but this portion of code isnt (server sided)
Report Abuse
KittehCatten is not online. KittehCatten
Joined: 22 Jul 2012
Total Posts: 509
30 Jan 2016 03:16 PM
So you just drop a random script onto a forum post without context, ask a simple question in the title, and give us absolutely zero background context on the script's location in the server, whether it's local, global, or part of a module, or even the REST OF THE SCRIPT THAT TRIGGERS THE FUNCTION declareLoser()!
Give us some background and then we may be able to come up with a solution.


Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 03:19 PM
No Errors or any output, Its in serverscriptservice and its a global script, and its fired by:


function initRound()
pickMap();
loadCharacters();
startTimer(roundTime);
declareLoser();
end;

wait(.2);
while true do
if game:GetService("Players").NumPlayers >= 2 then
initRound();
else
wait();
end;
end;
Report Abuse
iPenguinSuperTime is not online. iPenguinSuperTime
Joined: 25 Apr 2012
Total Posts: 3757
30 Jan 2016 03:22 PM
OnClientInvoke
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 03:23 PM
Example?
Report Abuse
iPenguinSuperTime is not online. iPenguinSuperTime
Joined: 25 Apr 2012
Total Posts: 3757
30 Jan 2016 03:26 PM
OnServerInvoke*

function RemoteFunction.OnServerInvoke(player, name)
print("example", player.Name)
return player.Name
end
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Jan 2016 03:27 PM
I don't think he understands this. I don't see what the problem is, though.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Jan 2016 03:28 PM
What is "owner"?
Report Abuse
wonderful72pike is online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
30 Jan 2016 03:30 PM
At the bottom you're treating the "players" variable, which is a table containing all players, like it's an instance.

if players["Character"]:findFirstChild("Alive") ~= nil then
winners = winners.." "..players.Name..""
if players:findFirstChild("leaderstats") ~= nil then
players.leaderstats.Wins.Value = players.leaderstats.Wins.Value + 1

You need to run this code iterating over every single player. I'll try to redo it so it works.
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 03:45 PM
Ive got this now; but its not giving the + 1 to the wins*



function declareLoser()
local winners = ""
local players = game:GetService("Players"):GetPlayers();
local msg = Instance.new("Message", game:GetService("Workspace"));
msg.Text = owner.Value.Name.." was the loser!";
wait(2);
msg:Destroy();
for i = 1, #players do
if players[i]["Character"]:findFirstChild("Alive") ~= nil then
winners = winners.." "..players[i].Name..""
if players[i]:findFirstChild("leaderstats") ~= nil then
players[i].leaderstats.Wins.Value = players[i].leaderstats.Wins.Value + 1
end
end
end
end;
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 03:52 PM
anyone?
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 08:06 PM
Bump.
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 09:04 PM
Help? Anyone?
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
30 Jan 2016 11:39 PM
Bump
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
31 Jan 2016 12:18 PM
Anyone?
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
31 Jan 2016 12:46 PM
Bump
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
31 Jan 2016 12:52 PM
I reformatted your code. Get rid of all the useless semicolons, parentheses, etc. Make it look clean.

function declareLoser()
local winners = ""
local msg = Instance.new("Message", workspace)
msg.Text = owner.Value.Name.." was the loser!"
wait(2)
msg:Destroy()
for i,v in next, game.Players:GetPlayers() do
if v.Character["Alive"] then
winners = winners.." "..v.Name
local stats = v:WaitForChild("leaderstats")
v.Wins.Value = v.Wins.Value + 1
end
end
end
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
31 Jan 2016 12:53 PM
Also, winners and winners will override eachother. You need to change the names
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