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

How to make a game pass that makes a player twice their size?

Asked by 4 years ago

Hello fellow developers and friends! I am interested as to how I can correctly make a game pass make a player twice their size in game if they own the game pass. I inserted a script into ServerScriptService. Here is what I wrote:

local MS = game:GetService("MarketplaceService") local ID = 10136218

if MS:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, ID) then wait(1) game.Players.LocalPlayer.Character.Humanoid.HeadScale = 2 game.Players.LocalPlayer.Character.Humanoid.BodyWidthScale = 2 game.Players.LocalPlayer.Character.Humanoid.BodyHeightScale = 2 game.Players.LocalPlayer.Character.Humanoid.BodyDepthScale = 2 end

It does not work and the output does not output anything? If anyone could help that would mean a life saver to me! Thanks.

0
try to use a code block [if thats what its called] for your scripts Clorize 31 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

Hey, I saw your script and I found a couple errors in it:

1) Since the script is Client-sided (LocalScript, I knew because LocalPlayer can't be used in a Server-sided script), you should consider changing it to a Server sided script in order for other players to see it

2) The other error i noticed in your script was that you did not specify .Value when giving values to let's say game.Players.LocalPlayer.Character.Humanoid.BodyHeightScale, a common mistake.

Here should be a Server sided and functioning version of your code:

local MS = game:GetService("MarketplaceService") local ID = 10136218

function playerAdded(player)
    local function onCharacterAdded(char)
        if MS:UserOwnsGamePassAsync(player, ID) then
            wait(1)
            char.Humanoid.HeadScale.Value = 2
        char.Humanoid.BodyWidthScale.Value = 2 
        char.Humanoid.BodyHeightScale.Value = 2 
        char.Humanoid.BodyDepthScale.Value = 2
        end
    end
    player.CharacterAdded:Connect(onCharacterAdded)
end

game.Players.PlayerAdded:Connect(playerAdded)

If it does not work, then please tell me the output, hope this helps!

0
Alright I shall try this out and put a regular script into ServerScriptService. bulder251 26 — 4y
0
Thank you for trying, the script seems to not be working and is outputting this: 14:43:46.165 - Unable to cast Instance to int64 bulder251 26 — 4y
0
Oh, I found out the problem, on line 5 replace player in if MS:UserOwnsGamePassAsync(player, ID) with player.UserId, because UserOwnsGamePassAsync needs the id and not name of actual player, sorry. TheOnlineItalian213 99 — 4y
0
Let me try that now, thanks. bulder251 26 — 4y
View all comments (2 more)
0
It worked thank you for your time and effort! bulder251 26 — 4y
0
No problem! TheOnlineItalian213 99 — 4y
Ad
Log in to vote
0
Answered by
iivSnooxy 248 Moderation Voter
4 years ago

Well I could tell you to use this link? :) https://www.youtube.com/watch?v=UYlN5N1Ury0 Is this works please accept the question it would help a ton!

0
I don't know how your answer helps that much really, he asked why his code didn't work and you just sent him a full tutorial, it's not helpful as you'd think it is. TheOnlineItalian213 99 — 4y

Answer this question