How do I convert this tycoon button script to use ServerStorage?
I need to try make this to load the tycoon parts from the ServerStorage instead of cloning them, but I don't really have an idea what to do, if anyone could guide me maybe, much appreciated.
02 | model = script.Parent.Parent.Parent.ITEMNAMEHERE |
05 | upgradeStuff = model:clone() |
10 | owner = script.Parent.Parent.Parent.OwnerName |
13 | function onTouched(hit) |
16 | check = hit.Parent:FindFirstChild( "Humanoid" ) |
19 | if hit.Parent.Name = = owner.Value then |
20 | local user = game.Players:GetPlayerFromCharacter(hit.Parent) |
21 | local stats = user:findFirstChild( "leaderstats" ) |
24 | local cash = stats:findFirstChild( "Cash" ) |
25 | if cash.Value > (Upgradecost- 1 ) then |
27 | cash.Value = cash.Value - Upgradecost |
28 | upgradeStuff.Parent = script.Parent.Parent.Parent |
29 | script.Parent.Parent:remove() |
40 | script.Parent.Touched:connect(onTouched) |