So I basically have a button inside a screenGUI in starterGUI in which is a localscript (in the button). I want to make a gamepass where if its clicked you shrink in size like described. Only whenever i press the button in studios i dont shrink and i dont get any errors.... Anyone knows whats wrong?
local player = game.Players.LocalPlayer local button = script.Parent local MarketPlaceService = game:GetService("MarketplaceService") local id = 18020349 script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id) game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased) if purchased and id == ido then player.Character.Humanoid.HeadScale.Value = 0.5 player.Character.Humanoid.BodyDepthScale.Value = 0.5 player.Character.Humanoid.BodyWidthScale.Value = 0.5 player.Character.Humanoid.BodyHeightScale.Value = 0.5 end end) end)
If you're trying to change stuff that other players apart from the client should see, do not use a LocalScript, as LocalScripts only change things on the client. This would mean that if you changed something on the client, it would not be replicated to the other players in the game (see this article for more information if wanted). https://developer.roblox.com/en-us/articles/Roblox-Client-Server-Model I did some tests and this worked with a regular Script as a child to a button (you may have to change the .Parent structure depending on where your button is located).
local player = script.Parent.Parent.Parent.Parent local button = script.Parent local MarketPlaceService = game:GetService("MarketplaceService") local id = 18020349 script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id) game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) == true then player.Character.Humanoid.HeadScale.Value = 0.5 player.Character.Humanoid.BodyDepthScale.Value = 0.5 player.Character.Humanoid.BodyWidthScale.Value = 0.5 player.Character.Humanoid.BodyHeightScale.Value = 0.5 end end) end)
There's probably a better way to locate the Player, however I just kept on adding .Parent until I reached it in the structure. Hope this helps!