So I was making a system using Data Store, it checks wich value is = “1” and it searchs the value’s name into a ReplicatedStorage folder but it isn’t working and not displaying whats wrong (I checked in the Player if the folder with the values was in there and it was with the value = “1” and the value is changed at Server Side in another place but still didn’t work) what I made wrong?
The script aparently don’t reach the first print that is the “print(“Found Value”)”
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Skins = ReplicatedStorage.Skins
game.Players.PlayerAdded:Connect(function(player)
for index, Object in pairs(player:WaitForChild("Inventory"):GetDescendants()) do
if Object:IsA("NumberValue") and Object.Value == 1 then
print("Found Value")
local CharacterClone = Skins:FindFirstChild(Object.Name)
CharacterClone.Parent = workspace.MainGame.Skins
CharacterClone.Weapon.Middle.CFrame = player.Character:WaitForChild("Right Arm").CFrame
CharacterClone.RightArm.Middle.CFrame = player.Character:WaitForChild("Right Arm").CFrame
CharacterClone.LeftArm.Middle.CFrame = player.Character:WaitForChild("Left Arm").CFrame
CharacterClone.RightLeg.Middle.CFrame = player.Character:WaitForChild("Right Leg").CFrame
CharacterClone.LeftLeg.Middle.CFrame = player.Character:WaitForChild("Left Leg").CFrame
CharacterClone.Torso.Middle.CFrame = player.Character:WaitForChild("Torso").CFrame
CharacterClone.Head.Middle.CFrame = player.Character:WaitForChild("Head").CFrame
print("Setted CFrame")
CharacterClone.Weapon.Middle.WeldConstraint.Part1 = player.Character:WaitForChild("Right Arm")
CharacterClone.Head.Middle.WeldConstraint.Part1 = player.Character:WaitForChild("Head")
CharacterClone.Torso.Middle.WeldConstraint.Part1 = player.Character:WaitForChild("Torso")
CharacterClone.RightArm.Middle.WeldConstraint.Part1 = player.Character:WaitForChild("Right Arm")
CharacterClone.LeftArm.Middle.WeldConstraint.Part1 = player.Character:WaitForChild("Left Arm")
CharacterClone.RightLeg.Middle.WeldConstraint.Part1 = player.Character:WaitForChild("Right Leg")
CharacterClone.LeftLeg.Middle.WeldConstraint.Part1 = player.Character:WaitForChild("Left Leg")
CharacterClone.Animations.Parent = player.Character
CharacterClone.BodyColors.Parent = player.Character
print("Setted Parent")
end
end
end)
Replicated Storage:
Player Folder: