I was making a class distribution function in a script in ServerScriptService
. The function works fine on the tool distribution function (Using plr.Backpack). But it seems really stubborn on Local script distribution.
The local script is supposed to be cloned and parented into the player's PlayerScripts
.
Doesn't want to listen.
Code for the Local script clone, needs to be parented to PlayerScripts. (Output error problem)
game.ReplicatedStorage.Specials.OnServerEvent:Connect(function(plr,Loadout) for i,v in pairs(game.ReplicatedStorage.Classes.Specials:FindFirstChild(Loadout):GetChildren()) do for c,d in pairs(game.ServerStorage.Specials:GetChildren()) do if v.Name == d.Name then print(d.Name) local Clone = d:Clone() Clone.Parent = plr.PlayerScripts end end end end)
The tool distribution script, in the same script as the local script being cloned.(Works)
game.ReplicatedStorage.Weapons.OnServerEvent:Connect(function(plr,Loadout) for i,v in pairs(game.ReplicatedStorage.Classes.Weapons:FindFirstChild(Loadout):GetChildren()) do for c,d in pairs(game.ServerStorage.Weapons:GetChildren()) do if v.Name == d.Name then print(d.Name) local Clone = d:Clone() Clone.Parent = plr.Backpack end end end end)