You think I can search this on YouTuber, but you are wrong. I have this game with a bank system I made and it has gold and cash you can take. I use stats in stead of leaderstats becuase I made a gui that can show the cash locally and privately. I want to create a part with a proximity prompt and if the player has gold and interacts the part with the proximity, it then removes all the gold stats and converts into cash stats and stores it over there. But how will I implement and script it? If there is a youtube video that provides someone I've said, then please let me know. Never done something like this before and that's why Im asking the community if they can help. Thanks.
So if I understand you correctly, you have a proximity prompt that is parented to a part. So when you trigger the proximity prompt, it'll convert all the gold to cash.
Insert a part to the workspace and parent a proximity prompt to the part.
Insert a script into the ServerScriptService and write the following code.
I'm gonna use leader stats since I'm not sure how your GUI works.
local proximityPrompt = workspace.Part.ProximityPrompt -- defining the proximity prompt game.Players.PlayerAdded:Connect(function(client) -- when the play joins. the client parameter will always be known as the player object no matter what you call the parameter local leaderstats = Instance.new('Folder') -- creates a folder leaderstats.Parent = client -- parents it to the player object leaderstats.Name = 'leaderstats' -- has to be named 'leaderstats' to work local gold = Instance.new('IntValue') -- creates a value which stores a number value gold.Parent = leaderstats gold.Name = 'Gold' -- naming the instance local cash = Instance.new('IntValue') -- does same thing as gold cash.Parent = leaderstats cash.Name = 'Cash' end) proximityPrompt.Triggered:Connect(function(client) -- when prompt gets triggered -- redefining them because Players.PlayerAdded function ended local leaderstats = client.leaderstats local gold = leaderstats.Gold local cash = leaderstats.Cash if gold.Value > 0 then -- checking whether the player has gold more than 0 cash.Value = cash.Value + gold.Value gold.Value = 0 else print("Player has no gold") end end)
its kinda easy to do what u said basically take the example of gold = 3 cash now its hard to explain so ill show u the script:
script.Parent.MouseClick:Connect(function(plr) -- im assuming ur proximity is a clickdetector local Cash = plr.PlayerGui.MainFrame.Cash.Value -- im assuming this is how ur gui looks like plr.PlayerGui.MainFrame.Gold.Value = plr.PlayerGui.MainFrame.Gold.Value + Cash * 3 plr.PlayerGui.MainFrame.Cash.Value = 0 -- and there u go end)