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

Can someone tell me why Clone() don't work in this script?

Asked by 8 years ago

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)
0
Do you have Studio API access on? Azmidium 388 — 8y
0
Yes. DevKarolus1 70 — 8y
0
Did you get any errors? If yes, post it. LetThereBeCode 360 — 8y
0
Try replacing "if char:WaitForChild("Humanoid") then" with "if char:FindFirstChild("Humanoid") then" LetThereBeCode 360 — 8y
0
Nope,i got 0 errors. Still don't work. DevKarolus1 70 — 8y

Answer this question