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 » Scripting Helpers
Home Search
 

Re: Dialog help

Previous Thread :: Next Thread 
FlameYeti is not online. FlameYeti
Joined: 14 Jan 2009
Total Posts: 22158
07 Oct 2014 07:56 PM
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"

local cash = Instance.new("IntValue",leaderstats)
cash.Name = "Cash"
cash.Value = 30

script.Parent.DialogChoiceSelected:connect(function(player,theDialog)
print(player)
print(theDialog)
if theDialog.Name == "Accept" and player.cash.Value > 49 then
local s = game.ServerStorage.ClassicSword:clone()
s.Parent = player.Backpack
player.cash.Value = player.cash.Value - 50
elseif player.cash.Value < 50 then
theDialog.ResponseDialog = "Sorry, you don't have enough"
elseif
theDialog.Name == "Decline" then
print("Your loss")
end
end
end)


Doesnt work.
Report Abuse
FlameYeti is not online. FlameYeti
Joined: 14 Jan 2009
Total Posts: 22158
07 Oct 2014 09:51 PM
Bump
Report Abuse
FlameYeti is not online. FlameYeti
Joined: 14 Jan 2009
Total Posts: 22158
07 Oct 2014 10:07 PM
Bump again
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
07 Oct 2014 10:14 PM
"Doesn't work"
Give us the output, what it does, does not, and is supposed to do.

Also, don't use "> 49"
Use ">= 50"
Report Abuse
FlameYeti is not online. FlameYeti
Joined: 14 Jan 2009
Total Posts: 22158
08 Oct 2014 07:26 AM
The output says cash is a nil value.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Oct 2014 07:51 AM
The stack trace would be helpful too.

But "cash" is never named "cash" so you can't find "parent.cash.value".
Just do "cash.value", or name it "cash".
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Oct 2014 07:52 AM
Besides that, even if it was named cash, it is parented to leaderstats right?

so you would have to do "player.leaderstats.cash.value" instead of "player.cash.value".
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