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

The players get a value but then for some reason they wont get the clone?

Asked by 4 years ago
Edited 4 years ago
    local mirclone = game:GetService("ReplicatedStorage").Mir:WaitForChild(player:WaitForChild("Mir").Value):Clone()    
    if mirclone:FindFirstChild("Kwami") then
        local mirmodel = mirclone:FindFirstChild("Kwami")       
    end
    mirclone.Parent = player:WaitForChild("Backpack")  
0
is it in a local script? deadwalker601 110 — 4y
0
no but this is running in serverscriptservice qwertyuiopasdfghhh 13 — 4y
0
did you set the variable "player"? Leamir 3138 — 4y
0
yes like this :game:GetService("Players").PlayerAdded:Connect(function(player) qwertyuiopasdfghhh 13 — 4y

1 answer

Log in to vote
1
Answered by
Elyzzia 1294 Moderation Voter
4 years ago

the player's backpack is reset whenever they spawn

usually, when PlayerAdded fires, the player's character won't have loaded yet, meaning the tool is deleted when they actually do spawn

you can put the tool in the player's StarterGear to ensure they get the tool every time they spawn, or if you just want them to have it the first time they spawn, you can wait for CharacterAdded to fire

-- StarterGear
local mirclone = game:GetService("ReplicatedStorage").Mir:WaitForChild(player:WaitForChild("Mir").Value):Clone()    
if mirclone:FindFirstChild("Kwami") then
    local mirmodel = mirclone:FindFirstChild("Kwami")       
end
mirclone.Parent = player:WaitForChild("StarterGear")

-- CharacterAdded
player.CharacterAdded:Wait()
local mirclone = game:GetService("ReplicatedStorage").Mir:WaitForChild(player:WaitForChild("Mir").Value):Clone()    
if mirclone:FindFirstChild("Kwami") then
    local mirmodel = mirclone:FindFirstChild("Kwami")       
end
mirclone.Parent = player:WaitForChild("Backpack")
0
can this be put into a serverscript? qwertyuiopasdfghhh 13 — 4y
Ad

Answer this question