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 |
|
|
|
| 26 Jun 2015 10:56 PM |
Any output
also fix this line
make it Humanoid.Health instead of Humanoid.health
-Baheeg |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|