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 » Scripters
Home Search
 

Re: Why doesn't this work?

Previous Thread :: Next Thread 
Akozta is not online. Akozta
Joined: 14 Dec 2008
Total Posts: 442
26 Jun 2015 10:54 PM
function onChatted(msg, recipient, speaker)

local source = speaker.Name

msg = string.lower(msg)

if string.sub(msg,1,5) == "Sell " then

if workspace:findFirstChild(speaker.Name) == nil then return end
if workspace:findFirstChild(speaker.Name).Humanoid.health <= 0 then return end

if string.sub(msg,6) == "Gun" then --Change this for every gun name.
if speaker.Backpack:findFirstChild("Gun") ~= nil then
speaker.Backpack.Gun:destroy()
speaker.leaderstats.cash.Value = speaker.leaderstats.cash.Value+50
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.playerAdded:connect(onPlayerEntered)
Report Abuse
Badlittlekevin1O1 is not online. Badlittlekevin1O1
Joined: 04 May 2013
Total Posts: 3322
26 Jun 2015 10:56 PM
Any output

also fix this line


make it Humanoid.Health instead of Humanoid.health


-Baheeg
Report Abuse
Akozta is not online. Akozta
Joined: 14 Dec 2008
Total Posts: 442
26 Jun 2015 11:00 PM
There is output but it is not letting me copy and paste it here.
Report Abuse
Akozta is not online. Akozta
Joined: 14 Dec 2008
Total Posts: 442
26 Jun 2015 11:03 PM
Basically it says that Workspace.Selling line 24: 'end' expected to close 'if' at line 12 near something called eof and the Parent property of GamepadService is locked, current parent: Place2, new parent NULL
Report Abuse
Badlittlekevin1O1 is not online. Badlittlekevin1O1
Joined: 04 May 2013
Total Posts: 3322
26 Jun 2015 11:03 PM
You missed alot of ends

function onChatted(msg, recipient, speaker)

local source = speaker.Name

msg = string.lower(msg)

if string.sub(msg,1,5) == "Sell " then

if workspace:findFirstChild(speaker.Name) == nil then return end
if workspace:findFirstChild(speaker.Name).Humanoid.Health <= 0 then return end

if string.sub(msg,6) == "Gun" then --Change this for every gun name.
if speaker.Backpack:findFirstChild("Gun") ~= nil then
speaker.Backpack.Gun:destroy()
speaker.leaderstats.cash.Value = speaker.leaderstats.cash.Value+50
end
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end


game.Players.playerAdded:connect(onPlayerEntered)


-Baheeg
Report Abuse
Proindustrialisation is not online. Proindustrialisation
Joined: 15 May 2015
Total Posts: 264
26 Jun 2015 11:04 PM
You forgot an end.

function onChatted(msg, recipient, speaker)

local source = speaker.Name

msg = string.lower(msg)

if string.sub(msg,1,5) == "Sell " then

if workspace:findFirstChild(speaker.Name) == nil then return end
if workspace:findFirstChild(speaker.Name).Humanoid.health <= 0 then return end

if string.sub(msg,6) == "Gun" then --Change this for every gun name.
if speaker.Backpack:findFirstChild("Gun") ~= nil then
speaker.Backpack.Gun:destroy()
speaker.leaderstats.cash.Value = speaker.leaderstats.cash.Value+50
end
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.playerAdded:connect(onPlayerEntered)
Report Abuse
Badlittlekevin1O1 is not online. Badlittlekevin1O1
Joined: 04 May 2013
Total Posts: 3322
26 Jun 2015 11:05 PM
Alot of ends @pro


-Baheeg
Report Abuse
Proindustrialisation is not online. Proindustrialisation
Joined: 15 May 2015
Total Posts: 264
26 Jun 2015 11:05 PM
Ignore my last post, you forgot three ends.

function onChatted(msg, recipient, speaker)

local source = speaker.Name

msg = string.lower(msg)

if string.sub(msg,1,5) == "Sell " then

if workspace:findFirstChild(speaker.Name) == nil then return end
if workspace:findFirstChild(speaker.Name).Humanoid.health <= 0 then return end

if string.sub(msg,6) == "Gun" then --Change this for every gun name.
if speaker.Backpack:findFirstChild("Gun") ~= nil then
speaker.Backpack.Gun:destroy()
speaker.leaderstats.cash.Value = speaker.leaderstats.cash.Value+50
end
end
end
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.playerAdded:connect(onPlayerEntered)
Report Abuse
Akozta is not online. Akozta
Joined: 14 Dec 2008
Total Posts: 442
26 Jun 2015 11:09 PM
Thanks so much guys, oh and may I ask where you learned how to script?
Report Abuse
Akozta is not online. Akozta
Joined: 14 Dec 2008
Total Posts: 442
26 Jun 2015 11:32 PM
I tried it and it still doesn't work. I fixed the output but now nothing happens...
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