Hello everyone, I have problem with Clone(). When player will buy game pass should get items from ReplicatedStorage.PassItems, but i don't know why don't work ;/ If someone can solve it.

Here is script:

local Vip = 298833834
local Ultra = 298834435
local Boom = 303658886

game.Players.PlayerAdded:connect(function(player)
	if game:GetService("GamePassService"):PlayerHasPass(player, Ultra) then
		local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
		cashmoney.Value = cashmoney.Value + 5000
		player.CharacterAdded:connect(function(char)
			if char:WaitForChild("Humanoid") then
				char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 25
				char.Humanoid.Health = char.Humanoid.Health + 25
				char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + 8
				game.ReplicatedStorage.PassItems.SpeedPotion:Clone().Parent = player.Backpack
			end
		end)
		local msg = Instance.new("Hint",workspace)
	    msg.Text = player.Name.." joined the game with Ultra V.I.P."
		wait(2)
		msg:Destroy()
	elseif game:GetService("GamePassService"):PlayerHasPass(player, Vip) then
		local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
		cashmoney.Value = cashmoney.Value + 200
		local msg = Instance.new("Hint",workspace)
		msg.Text = player.Name.." joined the game as a V.I.P."
		wait(2)
		msg:Destroy()
	elseif game:GetService("GamePassService"):PlayerHasPass(player, Boom) then
		player.CharacterAdded:connect(function(char)
			if char:WaitForChild("Humanoid") then
				game.ReplicatedStorage.PassItems.Boombox:Clone().Parent = player.Backpack
			end
		end)
	end
end)

5 comments

0

Do you have Studio API access on?

0

Yes.

0

Did you get any errors? If yes, post it.

0

Try replacing "if char:WaitForChild("Humanoid") then" with "if char:FindFirstChild("Humanoid") then"

0

Nope,i got 0 errors. Still don't work.