Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

	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")  

4 comments

0

is it in a local script?

0

no but this is running in serverscriptservice

0

did you set the variable "player"?

0

yes like this :game:GetService("Players").PlayerAdded:Connect(function(player)

1 answer

✓ Accepted answer

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")

1 comment

0

can this be put into a serverscript?

This discussion is preserved as it was. New answers, comments, and votes are closed.