Ad
Log in to vote
0

how can I make a saving shop system where you can re equip items if youve owned them before?

Asked by 1 month ago

I really need help with this system I understand this is not a request site so I would really appreciate example scripts or a link to a different article or full video on it. Thanks.

1 answer

Log in to vote
0
Answered by 1 month ago

This would be quite confusing, so I'm not quite sure if you'll understand this. Depending on whether or not you already have a shop set up, this can vary. Here's the basics,

-- I suggest putting this in your leaderstat script, or just make a statTracker script
game.Player.PlayersAdded:Connect(function(player)
        player.CharacterAdded:Connect(function(character)
        local weaponEquipped = Instance.new("StringValue", character)
        weaponEquipped.Name = "WeaponEquipped"
        weaponEquipped.Value = nil -- whatever you want your player to start off with, for example, you player could start off with fists, or start of with gloves

    end)
end)

Now you must locate the script that you put the equip sword script in, and modify it. Im assuming its either a tool, or user input service, so I'll represent both

--tool script
script.Parent.Equipped:Connect(function()
local player = game.Players.LocalPlayer
local character = player.Character

if character:WaitForChild("WeaponEquipped") then
    character.WeaponEquipped.Value = "Sword" -- put whatever you want
    end
end)

If you need help with more, send a message, because there is a lot more to cover on this topic

Ad

Answer this question