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
5 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.

1local gamepassid = 8172111
2local market = game:GetService("MarketplaceService")
3game.Players.PlayerAdded:Connect(function(plr)
4plr.CharacterAdded:Connect(function(char)
5if market:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
6    --bla bla bla
7end
8end)
9end)

2 answers

Log in to vote
0
Answered by 5 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.

1local nm = game.ReplicatedStorage.Model:Clone(); -- or whatever it is
2local c = player.Character;
3nm.Parent = workspace;
4nm:SetPrimaryPartCFrame(c.PrimaryPart.CFrame);
5player.Character = nm;
6c:Destroy();
7-- 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
5 years ago

Genaratedscript

I currently use this code:

01local gamepassid = 8172111
02local market = game:GetService("MarketplaceService")
03game.Players.PlayerAdded:Connect(function(plr)
04plr.CharacterAdded:Connect(function(char)
05if market:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
06    game.Players.LocalPlayer.Character = game.ServerStorage.StarterCharacter
07 
08end
09end)
10end)

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:

01local gamepassid = 8172111
02local market = game:GetService("MarketplaceService")
03game.Players.PlayerAdded:Connect(function(plr)
04plr.CharacterAdded:Connect(function(char)
05if market:UserOwnsGamePassAsync(plr.UserId,gamepassid) then
06    game.Players.LocalPlayer.Character = game.ServerStorage.StarterCharacter
07else  --so if they dont own it
08    game.Players.LocalPlayer.Character = game.ServerStorage.StarterCharacter2 --normal character
09 
10end
11end)
12end)

Answer this question