Hi! I’m having trouble trying to change a string value for my shop system. The string value is called “Outfit” And depending on which outfit you buy it’ll save the name so when you rejoin and it has the name of the outfit you’ll have it on your character. But for some reason I can’t change the string value in my script.
Video:
Local Shop Script:
MoneyCheck1 = LeftClickToBuy.MouseButton1Click:Connect(function()
print("Test")
local Data = {Outcome = "Checking2"}
YenRemote:FireServer(Data)
YenRemote.OnClientEvent:Connect(function(Data)
if Data.Outcome == "Invalid" then
BuyGuiFrame:WaitForChild("Cost").Text = "Not Enough Yen!"
elseif Data.Outcome == "Valid2" then
BuyGuiFrame:WaitForChild("Cost").Text = "Successfully Purchased!"
local data = {ClothingType = 2}
ClothingRemote:FireServer(data)
end
end)
Purchase Script Handler:
YenRemote.OnServerEvent:Connect(function(player, Data)
--Clothing
local ClothesFolder = game.Workspace.Shop.Clothes
local ClotheModel1ShirtTemplate = ClothesFolder:WaitForChild("ClotheModel1").Shirt.ShirtTemplate
local ClotheModel2ShirtTemplate = ClothesFolder:WaitForChild("ClotheModel2").Shirt.ShirtTemplate
local ClotheModel3ShirtTemplate = ClothesFolder:WaitForChild("ClotheModel3").Shirt.ShirtTemplate
local ClotheModel1PantsTemplate = ClothesFolder:WaitForChild("ClotheModel1").Pants.PantsTemplate
local ClotheModel2PantsTemplate = ClothesFolder:WaitForChild("ClotheModel2").Pants.PantsTemplate
local ClotheModel3PantsTemplate = ClothesFolder:WaitForChild("ClotheModel3").Pants.PantsTemplate
local Player = game:GetService("Players")
local Char = player.Character
local Stats = MainModule.GetStats(Char)
if Data.Outcome == "Checking" then
if Stats.Yen.Value < 50 then --- IF YOU DON'T HAVE ENOUGH MONEY
local Data = { Outcome = "Invalid"}
YenRemote:FireClient(player, Data)
print("Not Enough Yen!")
elseif Stats.Yen.Value >= 50 then -- IF YOU DO HAVE ENOUGH MONEY
Stats.Yen.Value = Stats.Yen.Value - 50 --Subtract 50
local Data = { Outcome = "Valid"}
YenRemote:FireClient(player, Data)
print("Transaction Completed")
end
elseif Data.Outcome == "Checking2" then
if Stats.Yen.Value < 75 then
local Data = {Outcome = "Invalid"}
YenRemote:FireClient(player, Data)
print("Not Enough Yen!")
else
Stats.Yen.Value = Stats.Yen.Value - 75
local Data = {Outcome = "Valid"}
YenRemote:FireClient(player, Data)
end
end
ClothingHandler Script:
ame.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Character = Player.Character
local ClothingRemote = game:GetService("ReplicatedStorage").Events.ClothingTypeRemote
local Clothing = game.ServerStorage.PlayerData:FindFirstChild(Player.Name).Stats.Outfit
local Outfits = game:GetService("ServerStorage").CAC.Outfits
local FireNationOutfits = Outfits.Obtainable["Firenation ClotheShop"]
Clothing.Value = "Firebending Kimono"
ClothingRemote.OnServerEvent:Connect(function(player, data)
local ClothesFolder = game.Workspace.Shop.Clothes
print("Working")
--FireNation Clothing
local ClotheModel1ShirtTemplate = ClothesFolder:WaitForChild("ClotheModel1").Shirt
local ClotheModel2ShirtTemplate = ClothesFolder:WaitForChild("ClotheModel2").Shirt.ShirtTemplate
local ClotheModel3ShirtTemplate = ClothesFolder:WaitForChild("ClotheModel3").Shirt.ShirtTemplate
local ClotheModel1PantsTemplate = ClothesFolder:WaitForChild("ClotheModel1").Pants.PantsTemplate
local ClotheModel2PantsTemplate = ClothesFolder:WaitForChild("ClotheModel2").Pants.PantsTemplate
local ClotheModel3PantsTemplate = ClothesFolder:WaitForChild("ClotheModel3").Pants.PantsTemplate
if data.ClothingType == 1 then
Clothing.Value = "Firebending Robe"
end
if data.ClothingType == 2 then
Clothing.Value = "Firebending Kimono"
end
end)
end)
if Stats.Outfit.Value == "Firebending Robe" then
char.Shirt.ShirtTemplate = ObtaniableOutfits["Firebending Robe"].Shirt.ShirtTemplate
char.Pants.PantsTemplate = ObtaniableOutfits["Firebending Robe"].Pants.PantsTemplate
elseif Stats.Outfit.Value == "Firebending Kimono" then
char.Shirt.ShirtTemplate = ObtaniableOutfits["Firebending Kimono"].Shirt.ShirtTemplate
char.Pants.PantsTemplate = ObtaniableOutfits["Firebending Kimono"].Pants.PantsTemplate
end