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

How can I make this tool give you a morph permanently?

Asked by 2 years ago

Hello!

I want to modify this script so that If you use the tool (Via activation) you will morph Into a morph permanently. When I mean permanently, I mean If you reset or leave the game, It will still have the morph on you, however, Im making a system where you can switch morphs to a default morph, so don't worry about It

Script:

local tool = script.Parent
local Debounce = false
local DrinkingAnimation = tool.Animation or tool:WaitForChild("Animation")
local Rep = game.ReplicatedStorage
local CharacterFolder = Rep.ExclusiveTrolls
local char = tool.Parent

tool.Activated:Connect(function()
    if not Debounce then
        Debounce = true
        tool:WaitForChild("Drink"):Play()
        local AnimationTrack = tool.Parent.Humanoid:FindFirstChild("Animator"):LoadAnimation(DrinkingAnimation)
        AnimationTrack:Play()
        wait(1.5)
        local player = game.Players:GetPlayerFromCharacter(tool.Parent)

        local plrRoot = player.Character:FindFirstChild("HumanoidRootPart") or player.Character.Parent:FindFirstChild("Torso")

        local AveragePlayer = CharacterFolder["Biblically accurate One-Shot"]:Clone()
        AveragePlayer.Name = player.Name
        player.Character = AveragePlayer

        local rootPart = AveragePlayer:FindFirstChild("HumanoidRootPart") or AveragePlayer:FindFirstChild("Torso")

        if rootPart and plrRoot then
            rootPart.CFrame = plrRoot.CFrame
        end

        AveragePlayer.Parent = workspace
        AveragePlayer.Humanoid.DisplayName = "Something"
        Debounce = false
        tool:Destroy()
    end
end)
0
Since you know how to write a script I will give you an idea how to do it. First you need a leaderboard to save the data for example if the tool will turn you into a dragon then you need a function that will send a data to a leaderboard that a player was a dragon then save the data........next you need a script which scan everytime a player join, example if statements that if a player is a dragon. AltairCelestia 47 — 2y
0
If a player is a dragon then change the default in to one, to do that you need to save the morph into server storage. I hope you understand this messed up explanation of mine. AltairCelestia 47 — 2y

1 answer

Log in to vote
1
Answered by
Puppynniko 1059 Moderation Voter
2 years ago
Edited 2 years ago

save via strings or objects might be very bad module

local module = {}
local DataStore = game:GetService("DataStoreService")
local RunS = game:GetService("RunService")
function module.SaveObject(Key,Value,DataStoreName)
    if RunS:IsClient() then error("Run in Server") end
    local DS = DataStore:GetDataStore(DataStoreName)
    local success,Error = pcall(function()
        DS:SetAsync(Key,Value)
    end)
    if success then
        return true
    else
        return error(Error)
    end
end
function module.GetObject(Key,Value,DataStoreName)
    if RunS:IsClient() then error("Run in Server") end
    local DS = DataStore:GetDataStore(DataStoreName)
    local Data
    local success,Error = pcall(function()
        Data = DS:GetAsync(Key)
    end)
    if success then
        return Data
    else
        return error(Error)
    end
end
return module

script

local Module = require(PathToModule)
--place Module.SaveObject(Player.UserId,Name of Morph,"PlayerMorphs") when you are trying to save (you can also use Datastore3)
and when accessing data
local Data = Module.GetObject(Player.UserId,"PlayerMorphs")
if Data then
    equipMorph(ListOfMorphs[Data]:Clone()) --assuming you have a morph equipping system
end
0
Ello! I (think) I don't have a morph system, the only morph system Is In the tool Itself, also where should I place the 2 scripts at? imnotaguest1121 362 — 2y
0
Oh and also, are both or one of the scripts for storing trolls or perm-saving trolls? imnotaguest1121 362 — 2y
0
And also, how do I set It up? imnotaguest1121 362 — 2y
0
the module can save and get stuff you saved also i haven't tested it yet Puppynniko 1059 — 2y
View all comments (4 more)
0
use SaveObject when the player changes morphs (if you want more efficiency you can use datastore2) then when rejoining equip the morph from a table that you get using brackets [Data] assuming its just saving that Puppynniko 1059 — 2y
0
Do you know where I should place both of the scripts? like the bottom script In ServerStorage imnotaguest1121 362 — 2y
0
also, If possible, mind If you can make a video on how to do It? imnotaguest1121 362 — 2y
0
you can place it any where it just how you use it Puppynniko 1059 — 2y
Ad

Answer this question