local money = script.Parent:WaitForChild("money").Value function payout(plr) local plrname = (plr.Name)--this is for later when the tycoon gets the name from the owner door local srvrmoney = game.Players[plrname]:FindFirstChild(leaderstats.money.Value)--might have to be changed to waitforchild idk yet if plr.Name == "macabe55101" then srvrmoney = money end end 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:
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 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 if hit.Parent:FindFirstChild('Humanoid') then -- If there is a humanoid then hit's parent is more likely to be a player local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr ~= nil then -- checks to see if it is actually a player local plrname = (plr.Name) -- plr's Name if plrname == 'macabe55101' then local srvrmoney = plrl:FindFirstChild('leaderstats').money --This is the object for srvrmoney srvrmoney.Value = money.Value -- Use value when calculating numbers with the value end end end end) game.Workspace.moneygiver.Touched:connect(payout)
If I am wrong please correct me, but if I helped please accept.