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

I am new to scripting i dont know much so please it says parent is not a valid member of tool what?

Asked by 4 years ago

where the error is

key1:Clone().parent = player.StarterGear

heres the entire code

local ServerStorage = game:GetService("ServerStorage")
local key = ServerStorage["keycardL2"]
local marketplacescervice = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local gamepassID = 429957

local function onPlayerAdded(player)
    local haspass = marketplacescervice:UserOwnsGamePassAsync(player.UserId, gamepassID)

    if haspass then
        print(player, "owns the gamepass with ID", gamepassID)
        local key1 = key:Clone()
        key1.Parent = player:WaitForChild("Backpack")
        key1:Clone().parent = player.StarterGear
        end
    end
    Players.PlayerAdded:Connect (onPlayerAdded)

1 answer

Log in to vote
0
Answered by 4 years ago

you forgot to capitalize part it should be key1:Clone().Parent

0
oh when i type script.parent it wont make me so im in the habbit of doing it.. LTRNightmare 66 — 4y
0
yup it worked thanks so much LTRNightmare 66 — 4y
Ad

Answer this question