This script would require two scripts. One to detect the mouse click and fire an event. The other to respond to said event and do the morphing.
For the event just make a folder in game.ReplicatedStorage call it whatever you want. Inside of that out a remote event and call that whatever you want. For this example the folder will be called "Remotes" and the remote event called "Morph"
For the local script you need to fire the event when the button is pressed. Using a local script inside of the button:
1 | local RepStore = game:GetService( "ReplicatedStorage" ) |
2 | local Event = RepStore.Remotes.Morph |
4 | script.Parent.MouseButton 1 Click:Connect(funtion() |
For the server sided script you need to check for the game pass then morph is the player owns the gamepass:
01 | local RepStore = game:GetService( "ReplicatedStorage" ) |
02 | local Event = RepStore.Remotes.Morph |
03 | local Market = game:GetService( "MarketplaceService" ) |
05 | local function morph(player) |
06 | if Market:UserOwnsGamePassAsync(player.UserId, PassIdHere) then |
07 | local char = player.Character |
09 | local hum = char:WaitForChild( "Humanoid" ) |
10 | if hum.Health > 0 then |
11 | for i, v in pairs (char:GetChildren()) do |
12 | if v:IsA( "Accessory" ) then |
16 | local bodycolors = char:FindFirstChild( "BodyColors" ) |
25 | Event.OnServerEvent:Connect(morph) |
I don't know the body color stuff off by heart so your gonna have to do that bit yourself but you can use Color3.fromRGB(R,G,B) and set it to each noob color for each body part. That's how you do it.
Hope this helps you