Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tool when cloned for replicatedstorage, script do not working how to fix?

Asked by 4 years ago
Edited 4 years ago

How to fix the item when cloned the script inside it does not work Here is my code

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
    local p = game.Players:GetPlayerFromCharacter(char)
    game.ReplicatedStorage.Medkit:Clone().Parent = p.Backpack       
    end)
end)

Thank you

0
Make sure "Medkit" is a tool and you have player object at the first place(in PlayerAdded event), you don't need to get the Player again from the Character. Block_manvn 395 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

Try doing this instead.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
    local p = game.Players:GetPlayerFromCharacter(char)
    local Medkit = game.ReplicatedStorage.Medkit:Clone()
         Medkit.Parent = p.Backpack
    end)
end)
0
Thank for answer! I'm testing please wait GalaxySMediaXz 32 — 4y
0
Question solved, thank for answer! GalaxySMediaXz 32 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Thank for the answer, The problem solved!

Answer this question