Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local players = game:GetService("Players")
- local pets = game.ReplicatedFirst.Pets
- local playersFolder = workspace.Players
- local createTemplate =
- game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("CreateTemplate")
- players.PlayerAdded:Connect(function(player)
- local folder = Instance.new("Folder")
- folder.Name = player.Name
- folder.Parent = playersFolder
- for i = 1,20,1 do
- --local newPet = pets[i]:Clone()
- --newPet.Parent = folder
- createTemplate:FireClient(player, pets[i].Name, i)
- end
- end)
- game.ReplicatedStorage.Remotes.EquipPet.OnServerEvent:Connect(function(player,petName, id)
- local petModel = game.ReplicatedFirst.Pets:FindFirstChild(petName):Clone()
- petModel.Parent = workspace.Players:WaitForChild(player.Name)
- petModel.Id.Value = id
- end)
- game.ReplicatedStorage.Remotes.UnequipPet.OnServerEvent:Connect(function(player, petName, id)
- local playerFolder = workspace.Players:FindFirstChild(player.Name)
- for i, pet in pairs(playerFolder:GetChildren()) do
- if pet.Id.Value == id then -- znaleziony pet do usunięcia
- pet:Destroy()
- end
- end
- end)
- for _, item in pairs(workspace.Areas:GetDescendants()) do
- if item.Name == "Barrier" then
- item.Attachment.ProximityPrompt.Triggered:Connect(function(player)
- if player.leaderstats.Coins.Value >= item.AreaPrice.Value then
- player.leaderstats.Coins.Value -= item.AreaPrice.Value
- local area = Instance.new("StringValue", player.Areas)
- area.Name = item.Parent.Name
- game.ReplicatedStorage.Remotes.Area:FireClient(player, item)
- end
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement