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

A. how to fix this morph gui b. how to add a gamepass?

Asked by
hokyboy 270 Moderation Voter
5 years ago
Edited 5 years ago
script.Parent.MouseButton1Click:Connect(function()
    game.StarterPlayer.Noob.Name = "StarterPlayer"
    game.Players.LocalPlayer.Humanoid.Health = 0
end)

i want a system if a player has a gamepass he can morph into a noob via a gui i also need help cuz i dont know how to define humanoid to kill the play

0
First of all your gonna wanna format your script. So I can actually look at it properly Protogen_Dev 268 — 5y
0
sorry i forgot Xxd hokyboy 270 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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:

local RepStore = game:GetService("ReplicatedStorage") 
local Event = RepStore.Remotes.Morph

script.Parent.MouseButton1Click:Connect(funtion()
    Event:FireServer()
end)

For the server sided script you need to check for the game pass then morph is the player owns the gamepass:

local RepStore = game:GetService("ReplicatedStorage") 
local Event = RepStore.Remotes.Morph
local Market = game:GetService("MarketplaceService")

local function morph(player)
    if Market:UserOwnsGamePassAsync(player.UserId, PassIdHere) then
        local char = player.Character
        if char then
            local hum = char:WaitForChild("Humanoid") 
            if hum.Health > 0 then
                for i, v in pairs(char:GetChildren()) do
                    if v:IsA("Accessory") then
                        v:Destory() 
                    end
                end
                local bodycolors = char:FindFirstChild("BodyColors") 
                if bodycolors then
                    --put script here
                end
            end
        end
    end
end

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

0
I dont get if fully can i add you on team creates? hokyboy 270 — 5y
0
Sure but I won't be able to do anything till my Internet is back up Protogen_Dev 268 — 5y
0
I sent you friend request hokyboy 270 — 5y
0
i have to go man maybe tommrow hokyboy 270 — 5y
0
Ye I'll accept it when I have Internet Protogen_Dev 268 — 5y
Ad

Answer this question