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

how to make custom StarterCharacter gamepass?

Asked by
n_ubo 29
4 years ago

There seem to be no solutions to this question,

The problem is that a free player already gets a custom player rig, and what I want is that if the player buys a game pass he gets a modified one. I have got answers earlier that I have to use Humanoid description but this doesn't seem to work at all since its a custom player rig. I have made the game pass event script already but don't know how to make it do what I want it to.

local gamepassid = 8172111 
local market = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if market:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
    --bla bla bla
end
end)
end)

2 answers

Log in to vote
0
Answered by 4 years ago

What you would do is have the model prepared in ReplicatedStorage, then after checking if they own the gamepass, set the local player's character to the model. Your best bet is to use a Remote Event/Function, as the localplayer is always passed as the first argument.

local nm = game.ReplicatedStorage.Model:Clone(); -- or whatever it is
local c = player.Character;
nm.Parent = workspace;
nm:SetPrimaryPartCFrame(c.PrimaryPart.CFrame);
player.Character = nm;
c:Destroy();
-- You should also update CurrentCamera in a localscript so it's CameraSubject is the new model. Like I said, RemoteFunctions are best used here so you can return the new character clone, then just set workspace.CurrentCamera.CameraSubject = nm (or the returned value).

NOTE: This code has not been tested but should work if implemented with RemoteFunctions.

Ad
Log in to vote
0
Answered by
n_ubo 29
4 years ago

Genaratedscript

I currently use this code:

local gamepassid = 8172111 
local market = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if market:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
    game.Players.LocalPlayer.Character = game.ServerStorage.StarterCharacter

end
end)
end)

What i'm actually trying to achieve is when a player spawns they get a startercharacter implemented to their character, and if they own the gamepass they get another one

just like:

local gamepassid = 8172111 
local market = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if market:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
    game.Players.LocalPlayer.Character = game.ServerStorage.StarterCharacter
else  --so if they dont own it
    game.Players.LocalPlayer.Character = game.ServerStorage.StarterCharacter2 --normal character

end
end)
end)

Answer this question