01 | local money = script.Parent:WaitForChild( "money" ).Value |
02 | function payout(plr) |
03 | local plrname = (plr.Name) --this is for later when the tycoon gets the name from the owner door |
04 | local srvrmoney = game.Players [ plrname ] :FindFirstChild(leaderstats.money.Value) --might have to be changed to waitforchild idk yet |
05 | if plr.Name = = "macabe55101" then |
06 | srvrmoney = money |
07 | end |
08 | end |
09 |
10 | game.workspace.moneygiver.Touched:connect(payout) |
this is the best I have so far I think I messed up with the syntax needed on line 1... Im trying to transfer the value of a intvalue to another in a player in leaderstats once the game is run.
Value has not been used correctly:
01 | local money = script.Parent:WaitForChild( 'money' ) -- Using the value of the object will get the value for one time only, so use the object and get the value later |
02 |
03 | function payout(hit) -- Change plr to hit because this function is being called by a touched event, hit is the part that is being hit |
04 |
05 | if hit.Parent:FindFirstChild( 'Humanoid' ) then -- If there is a humanoid then hit's parent is more likely to be a player |
06 |
07 | local plr = game.Players:GetPlayerFromCharacter(hit.Parent) |
08 |
09 | if plr ~ = nil then -- checks to see if it is actually a player |
10 |
11 | local plrname = (plr.Name) -- plr's Name |
12 |
13 | if plrname = = 'macabe55101' then |
14 | local srvrmoney = plrl:FindFirstChild( 'leaderstats' ).money --This is the object for srvrmoney |
15 |
If I am wrong please correct me, but if I helped please accept.