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

I got a HUGE problem im trying to make a StarterCharacter Gamepass?


Im trying to make a StarterCharacter gamepass. When they buy the gamepass they get a in game skin. The script works its just when ever i spawn im invis and i cant move.

The script i used

local GamepassId = (10797682)

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local GamepassStarterCharacter = ServerStorage.StarterCharacter

local GamepassFunction = function(Player)
    if not Player:IsA("Player") then
        return
    end
    Player.CharacterAdded:Connect(function(Character)
        local function LoadCharacter(Path)
            for i,v in pairs(Character:GetChildren()) do
                v:Destroy()
            end
            for i,v in pairs(Character:GetChildren()) do
                v:Clone().Parent = Character
            end
            if not Character:FindFirstChildOfClass("Humanoid") then
                Instance.new("Humanoid",Character)
            end
        end
        if MarketplaceService:UserOwnsGamePassAsync(Player.UserId,GamepassId) then
            LoadCharacter(GamepassStarterCharacter)
        else
            LoadCharacter(ServerStorage.RedSkin)
        end
    end)
end

for i,v in pairs(Players:GetPlayers()) do
    GamepassFunction(v)
end
Players.PlayerAdded:Connect(GamepassFunction)

5 comments

0

Could you put the code in a code block? Edit the question, select the code and click the blue "Lua" icon. For more information, click this and scroll to the bottom: https://scriptinghelpers.org/help/how-post-good-questions-answers

0

I added it for you

0

i edited it did i do it correectly?

0

its anchored, weld and your destroying all of it, put destroy the old character then insert new costume because your putting it then destroying.

0

its not anchored i checked all the parts and the humaniod plus the humaniod root part

1 answer

Your just destroying the character and adding a humanoid in the empty character model??

How about try this

local GamepassId = 10797682

local MarketplaceService = game:GetService("MarketplaceService")
local GamepassStarterCharacter = game.ServerStorage.StarterCharacter

local GamepassFunction = function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local function LoadCharacter(Path)
      --[[ in case you want starter scripts
            for _, v in pairs(Character:GetChildren()) do
                if v.ClassName ~= "Script" or v.ClassName ~= "LocalScript" then
                    v:Destroy()
                end
            end
            ]]
            Character:Destroy()
            Path.Parent = workspace
            Character = Path
        end
        if --[[not]] MarketplaceService:UserOwnsGamePassAsync(Player.UserId,GamepassId) then --Idk I think you meant to check if they don't own it
            LoadCharacter(GamepassStarterCharacter)
        else
            LoadCharacter(game.ServerStorage.RedSkin)
        end
    end)
end

game.Players.PlayerAdded:Connect(GamepassFunction)

I'm deleting the starter character then inserting your model instead for the character. I'm not sure if this works but I seen somebody do it before.

Also, if this did not work then just recolor the character and stuff.

8 comments

0

no i actually have a model already made in server storage but the thing is im invis whenever i spawn. So if a player bought the gamepass they would spawn invis and not able to walk

0

heres my discord ima show you pictures of whats happening Data Cords#7176

0

I just wrote up a script for you to test bruh. Did you tyr it? Did the same issue reproduce?

0

Yeah

0

i tired your script and it worked but im stil invis and i still cant walk

0

i also keep getting this error - LoadAnimation requires the Humanoid object (DataCordz.Humanoid) to be a descendant of the game object

0

That's your script error. You're supposed to clone the character object in workspace. Also edited the script.

0

Sorry im new to scripting so im pretty sure its like this? Clone().Parent = Character or something like that because if i put that into the script it still doesn't work

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