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: Help :O

Previous Thread :: Next Thread 
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 06:01 AM
How do I go about creating a script which sends cash directly to your ingame leaderstats (when in contact with a part, for eg. a dropper)
, instead of having to use a "cash to collect" object?

Can't seem to work it out
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 06:03 AM
Value1 = game.workspace.Values.Value1
Receiver = game.workspace.Values.Receiver
part = game.workspace.PartStorage.part

function
if part:connect ("Receiver")
then LocalPlayer.leaderstats.("Cash") +Value
wait(1)
part:Destroy


end
end



all I can come up with
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 06:06 AM
or even

script.Parent.Receiver.Touched:connect(function(Part)
if Part:FindFirstChild("Cash") then
Part.Cash.Value = Part.Cash.Value


how would I finish that ^
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 06:09 AM
script.Parent.Receiver.Touched:connect(function(Part)
if Part:FindFirstChild("Cash") then
LocalPlayer.leaderstats.Cash + Part.Cash.Value


idk so lost
Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
21 Apr 2017 06:16 AM
Boo, hi

Something like this
script.Parent.Touched:Connect(function(Part)
local Player = game.Players:GetPlayerFromCharacter(Part)
if(Player ~= nil)then
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + 50
end
end)


Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
21 Apr 2017 06:16 AM
Error, change 'local Player = game.Players:GetPlayerFromCharacter(Part)' to 'local Player = game.Players:GetPlayerFromCharacter(Part.Parent)' oops


Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 06:18 AM
That looks good, cheers bro, will test
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 06:20 AM
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + 50

So instead of having this line, what could I write so that it would find the Value from workspace, or server storage?
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Apr 2017 06:27 AM
Yes you could do that.
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 08:05 AM
Still having trouble with this, can anyone help?
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 08:25 AM
bump
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Apr 2017 08:26 AM
What are you having trouble with?
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 08:28 AM
Right,

I'm trying to create an alternative to the "cash to collect" mechanism in tycoon games, so that once the dropper drops a part, it hits a brick and goes into the tycoons leaderstats, in this case Cash.

I can't figure out how to create this script though
I know it's been made before but I can't find one

Thanks for your help
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 08:29 AM
And obviously each droppers part will have a different cash value, but I've already done that bit
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Apr 2017 08:30 AM
The script that currently removes parts when they touch the end, could you post it here?
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 08:31 AM
I haven't created anything (which works) yet to do with the part receiver, but I can try and find it
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Apr 2017 08:33 AM
You'll need to finish that script first then, because basically the only thing you have to change is the part that normally adds cash to the collection part when money maker parts reach the end, change it to add to their leaderstats instead.
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 09:05 AM
--Parts that fall into the collector(s) get processed
for i,v in pairs(script.Parent.Essentials:GetChildren()) do
if v.Name == "PartCollector" then
v.Touched:connect(function(Part)
if Part:FindFirstChild('Cash') then
Money.Value = Money.Value + Part.Cash.Value
Debris:AddItem(Part,0.1)
end
end)
end
end
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 09:08 AM
--Player Touched Collector processor
deb = false
script.Parent.Essentials.Giver.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
if script.Parent.Owner.Value == player then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.Health > 0 then
if deb == false then
deb = true
script.Parent.Essentials.Giver.BrickColor = BrickColor.new("Bright red")
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Stats ~= nil then
Sound(script.Parent.Essentials, Settings.Sounds.Collect)
Stats.Value = Stats.Value + Money.Value
Money.Value = 0
wait(1)
script.Parent.Essentials.Giver.BrickColor = BrickColor.new("Sea green")
deb = false
end
end
end
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 09:08 AM
But I want to completely remove the collection part, It just needs to go into the leaderstats automatically.
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Apr 2017 09:18 AM
Are you trying to remove the cash collector the player steps on or trying to remove parts that go down the track?
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 09:19 AM
I'm trying to remove the process of having to collect your money, and instead the money goes straight into your leaderstat.
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 09:21 AM
So, the dropper drops a part, which then goes down the conveyor, and hits a part called (for e.g) "Receiver"

Receiver then has a script inside of it which then sends the value of the part into your leaderstat.

So a part with a value of 20 hits the "receiver" and then the receiver processes it and gives you 20 cash automatically.
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Apr 2017 09:22 AM
So in your Receiver script, just add money to their leaderstats instead of to a collector
Report Abuse
HYPERSPACE922 is not online. HYPERSPACE922
Joined: 21 Apr 2009
Total Posts: 146
21 Apr 2017 09:27 AM
so how would I edit this to be able to find the value of the part?

You can change the ammount of money you get by changing the 2000 to whatever you want.

amnt = 2000
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Cash")
if (score~=nil) then
score.Value = score.Value + amnt
end
end
end
script.Parent:remove()
end
end

script.Parent.Touched:connect(onTouched)
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