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: Any Ideas Why This Won't Work?

Previous Thread :: Next Thread 
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
24 Mar 2012 02:38 PM
function onChatted(msg, recipient, speaker)

local source = string.lower(speaker.Name)
msg = string.lower(msg)

if (source ~= "TheSoMekTime") then return end

if string.match(msg, "givepoints/") then
local p = game.Players:children()
for i = 1, #p do
if string.match(msg, string.lower(p[i].Name)) then
p[i].leaderstats.Points.Value= p[i].leaderstats.Points.Value + 50
end
end
end
end

function playerAdded(player)
player.Chatted:connect(onChatted)
end

game.Players.PlayerAdded:connect(playerAdded)
Report Abuse
adjotur is not online. adjotur
Joined: 10 Oct 2011
Total Posts: 892
24 Mar 2012 02:40 PM
if (source ~= "thesomektime") then return end
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
24 Mar 2012 02:41 PM
[ Content Deleted ]
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
24 Mar 2012 03:04 PM
Thanks rangersmash, I'll go test it out now.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
24 Mar 2012 03:05 PM
Rangersmash's script shouldn't work.
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
24 Mar 2012 03:09 PM
You're right, it didn't. Btw sorry this is the PROPER script.

function onChatted(msg, recipient, speaker)

local source = string.lower(speaker.Name)
msg = string.lower(msg)

if (source ~= "TheSoMekTime") then return end

if string.match(msg, "/givepoints") then
local p = game.Players:children()
for i = 1, #p do
if string.match(msg, string.lower(p[i].Name)) then
p[i].leaderstats.money.Value= p[i].leaderstats.money.Value + 100 --Just this line changed to "money" because in the leaderboard it is the money Value not Points.
end
end
end
end

function playerAdded(player)
player.Chatted:connect(onChatted)
end

game.Players.PlayerAdded:connect(playerAdded)
Report Abuse
gamehero is not online. gamehero
Joined: 12 Jun 2007
Total Posts: 1455
24 Mar 2012 04:00 PM
Normally I test this stuff before I post them.. But I think I found the problem..
"speaker" was returning "nil" causing the script to end immediantly on line 6-7.

Hopefully I fixed it now...



function onChatted(msg, recipient, speaker)

local source = string.lower(speaker.Name)
msg = string.lower(msg)

if (source ~= "TheSoMekTime") then return end

if string.match(msg, "/givepoints") then
local p = game.Players:children()
for i = 1, #p do
if string.match(msg, string.lower(p[i].Name)) then
p[i].leaderstats.money.Value= p[i].leaderstats.money.Value + 100 --Just this line changed to "money" because in the leaderboard it is the money Value not Points.
end
end
end
end

function playerAdded(player)
player.Chatted:connect(function(msg,rec) onChatted(msg,rec,player) end)
end

game.Players.PlayerAdded:connect(playerAdded)
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
24 Mar 2012 05:28 PM
[ Content Deleted ]
Report Abuse
headjoe2 is not online. headjoe2
Joined: 26 Aug 2010
Total Posts: 971
24 Mar 2012 05:36 PM
if the source ISNT you, then it will end the function lol
Report Abuse
headjoe2 is not online. headjoe2
Joined: 26 Aug 2010
Total Posts: 971
24 Mar 2012 05:41 PM
try this instead:

if (source == "TheSoMekTime") then return end

on tha one line, it made it work for everybody BUT you. you did this:

if (source ~= "TheSoMekTime") then return end

notice the ~= and == difference?
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 01:49 AM
I'll go test all these theories out now and tell you guys what happened.
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 01:57 AM
Btw I want the script to work only by me. So wouldn't it be "==" or would it stay "~="?
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 02:04 AM
Your theories didn't work guys, I don't know if this would be any help to you but here is my leaderboard script.

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"

local money = Instance.new("IntValue", leaderstats)
money.Name = "Money"
money.Value = 0
end)
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
25 Mar 2012 02:45 AM
[ Content Deleted ]
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
25 Mar 2012 02:49 AM
@headjoe2,

You read the code wrong...
Don't be so conceited because 2/3 of the time, you're wrong.
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 06:03 AM
Do you think you can fix the code Phellem?
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 01:14 PM
BUMP
Report Abuse
rollingthunder101 is not online. rollingthunder101
Joined: 18 Aug 2011
Total Posts: 59
25 Mar 2012 01:17 PM
You put
source as string.lower(Speaker.Name) but the thing is you put it in caps error much?
Report Abuse
rollingthunder101 is not online. rollingthunder101
Joined: 18 Aug 2011
Total Posts: 59
25 Mar 2012 01:19 PM
    function onChatted(msg, recipient, speaker)
    
        local source = string.lower(speaker.Name)
        msg = string.lower(msg)
    
        if (source ~= "thesomektime") then return end
    
        if string.match(msg, "givepoints/") then
            local p = game.Players:children()
            for i = 1, #p do
                if string.match(msg, string.lower(p[i].Name)) then
                    p[i].leaderstats.Points.Value= p[i].leaderstats.Points.Value + 50
                end
            end
        end
    end
    
    function playerAdded(player)
        player.Chatted:connect(onChatted)
    end
    
    game.Players.PlayerAdded:connect(playerAdded)
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 01:24 PM
Caps error? I don't see the caps error in mine.
Report Abuse
rollingthunder101 is not online. rollingthunder101
Joined: 18 Aug 2011
Total Posts: 59
25 Mar 2012 01:25 PM
local source = string.lower(speaker.Name)
msg = string.lower(msg)
if (source ~= "TheSoMekTime") then return end


Your lowering the speaker's name and source will never equal TheSoMekTime because you lowered the speaker's name -.-
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 01:27 PM
Ohhh - I see it now....
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 01:28 PM
I get it, wow all that and it was just that? I kept capitalizing my name EVERYTIME. Wow...
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 01:37 PM
OK - It still doesn't work, this is my script EXACTLY how it is now.

function onChatted(msg, recipient, speaker)

local source = string.lower(speaker.Name)
msg = string.lower(msg)

if (source ~= "thesomektime") then return end

if string.match(msg, "givemoney/") then
local p = game.Players:children()
for i = 1, #p do
if string.match(msg, string.lower(p[i].Name)) then
p[i].leaderstats.money.Value= p[i].leaderstats.money.Value + 100
end
end
end
end

function playerAdded(player)
player.Chatted:connect(onChatted)
end

game.Players.PlayerAdded:connect(playerAdded)
Report Abuse
TheSoMekTime is not online. TheSoMekTime
Joined: 14 Mar 2009
Total Posts: 191
25 Mar 2012 03:14 PM
Come on...
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