So I am trying to make a shop that that you can buy stuff in by going into there but when It tried to make the scripts it didn't work.

Here are the scripts.

Script:ServerScriptService:

game.Players.PlayerAdded:Connect(function(player)
	local folder = Instance.new("Folder")
	folder.Name = "Clothes"
	folder.Parent = player
	local current = Instance.new("StringValue")
	current.Name = "CurrentClothes"
	current.Parent = folder
	local shirt = Instance.new("StringValue")
	shirt.Name = "Shirt"
	shirt.Parent = current
	local pants = Instance.new("StringValue")
	pants.Name = "Pants"
	pants.Parent = current
end)

game.ReplicatedStorage.BuyClothes.OnServerEvent:Connect(function(player,shirt,pants,cName)
	player.Character.Shirt.ShirtTemplate = shirt
	player.Character.Paants.PantsTemplate = pants
	player.Clothes.CurrentClothes.Value = cName
	player.Clothes.CurrentClothes.Shirt.Value = shirt
	player.Clothes.CurrentClothes.Pants.Value = pants
	local clothes = game.ServerStorage.Clothes:FindFirstChild(cName):Clone()
	clothes.Parent = player.Clothes
end)

LocalScript:TextButton:SurfaceGui:StarterGui:

local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local price = script.Parent.Parent.Price 
local shirt = workspace.Clothes:FindFirstChild(script.Parent.Parent.Name).Coathanger.Shirt.ShirtTemplate
local pants = workspace.Clothes:FindFirstChild(script.Parent.Parent.Name).Coathanger.Pants.PantsTemplate

script.Parent.MouseButton1Click:Connect(function()
	if leaderstats["Cash"].Value >= price.Value then
		if not player:WaitForChild("Clothes"):FindFirstChild(script.Parent.Parent.Name) then
		leaderstats["Cash"].Value = leaderstats["Cash"].Value - price.Value
		game.ReplicatedStorage.BuyClothes:FireServer(shirt,pants,script.Parent.Parent.Name)
		end
	end
end)



3 comments

2

Can you add some more details about what is not working and any errors you get.

0

Include more details. You cannot just post your scripts and say "fix them", as not everyone has a lua interpreter in their brain xd, and people aren't going to make a new studio file and recreate stuff like the leaderstats and the remotes just to check what's wrong with your code.

0

Exactly.