Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

Hi! I want to make the tool give you a perm morph, basically, when you use the tool, It will morph you, but the morph won't go away. This Is a script I made; this script gives you a morph however the morph will disappear when you reset or leave the game, I want It so the morph stays even If you die or leave the game

Also, Im not an advance scripter btw, I just got It by an old post I posted here

Stuff: If your wondering where the morph system Is, the morph system In Inside of the tool, the morph system In not In ReplicatedStorage,ServerStorage,ServerScriptServices,Etc, Its only In the tool

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 and tool.Parent.CanDrink.Value == true then
		Debounce = true
		tool:WaitForChild("Drink"):Play()
		local AnimationTrack = tool.Parent.Humanoid:FindFirstChild("Animator"):LoadAnimation(DrinkingAnimation)
		AnimationTrack:Play()
		wait(0.50)
		tool.Handle.Ice.Transparency = 1
		tool.Handle.Oil.Transparency = 1
		wait(1)
		local OilCupTroll = math.random(1,1)
		
		if OilCupTroll == 1 then
			local player = game.Players:GetPlayerFromCharacter(tool.Parent)

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

			local AveragePlayer = CharacterFolder["Reaper"]: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 = "Trollge"
		end
		if OilCupTroll == 2 then
			local player = game.Players:GetPlayerFromCharacter(tool.Parent)

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

			local AveragePlayer = CharacterFolder["HD Troll"]: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 = "HD Troll"
		end
		if OilCupTroll == 3 then
			local player = game.Players:GetPlayerFromCharacter(tool.Parent)

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

			local AveragePlayer = CharacterFolder["BrickBattler"]: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 = "BrickBattler"
		end
		Debounce = false
		tool:Destroy()
	end
end)

1 answer

✓ Accepted answer

Hello! I believe I have found your solution. First of all, go to your game, go to the Home tab, then go to Security and then enable Enable Studio Access to API Services.

Now, onto the code. In your tool:

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 and tool.Parent.CanDrink.Value == true then
		Debounce = true
		tool:WaitForChild("Drink"):Play()
		local AnimationTrack = tool.Parent.Humanoid:FindFirstChild("Animator"):LoadAnimation(DrinkingAnimation)
		AnimationTrack:Play()
		wait(0.50)
		tool.Handle.Ice.Transparency = 1
		tool.Handle.Oil.Transparency = 1
		wait(1)
		local OilCupTroll = math.random(1,3)

		if OilCupTroll == 1 then
			local player = game.Players:GetPlayerFromCharacter(tool.Parent)
			player.CurrentMorph.Value = "Reaper"
			
			local plrRoot = player.Character:FindFirstChild("HumanoidRootPart") or player.Character.Parent:FindFirstChild("Torso")

			local AveragePlayer = CharacterFolder["Reaper"]:Clone()
			AveragePlayer.Name = player.Name
			AveragePlayer.Parent = workspace

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

			if rootPart and plrRoot then
				rootPart.CFrame = plrRoot.CFrame
			end
			
			player.Character = AveragePlayer

			AveragePlayer.Humanoid.DisplayName = "Trollge"
		end
		if OilCupTroll == 2 then
			local player = game.Players:GetPlayerFromCharacter(tool.Parent)
			player.CurrentMorph.Value = "HD Troll"

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

			local AveragePlayer = CharacterFolder["HD Troll"]:Clone()
			AveragePlayer.Name = player.Name
			AveragePlayer.Parent = workspace
			
			local rootPart = AveragePlayer:FindFirstChild("HumanoidRootPart") or AveragePlayer:FindFirstChild("Torso")

			if rootPart and plrRoot then
				rootPart.CFrame = plrRoot.CFrame
			end
			
			
			player.Character = AveragePlayer
			AveragePlayer.Humanoid.DisplayName = "HD Troll"
		end
		if OilCupTroll == 3 then
			local player = game.Players:GetPlayerFromCharacter(tool.Parent)
			player.CurrentMorph.Value = "BrickBattler"
			

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

			local AveragePlayer = CharacterFolder["BrickBattler"]:Clone()
			AveragePlayer.Name = player.Name
			AveragePlayer.Parent = workspace

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

			if rootPart and plrRoot then
				rootPart.CFrame = plrRoot.CFrame
			end
			
			player.Character = AveragePlayer
			
			AveragePlayer.Humanoid.DisplayName = "BrickBattler"
		end
		Debounce = false
		tool:Destroy()
	end
end)

Now, create a new script in ServerScriptService. Insert this:

local CharacterFolder = game.ReplicatedStorage.ExclusiveTrolls
local store = game:GetService("DataStoreService")
local store2 = store:GetDataStore("Morph")

function save(p,val)
	store2:SetAsync(p.UserId,val)
end

game.Players.PlayerAdded:Connect(function(p)
	local val = store2:GetAsync(p.UserId) or ""
	
	local stringv = Instance.new("StringValue",p)
	stringv.Name = "CurrentMorph"
	stringv.Value = val
	p.CharacterAdded:Connect(function(c)
		if stringv.Value ~= "" then
			local oldchar = c
			local oldv = stringv.Value
			stringv.Value = ""
			local plrRoot = p.Character:WaitForChild("HumanoidRootPart") or p.Character.Parent:WaitForChild("Torso")

			local AveragePlayer = CharacterFolder["BrickBattler"]:Clone()
			AveragePlayer.Name = p.Name
			
			local rootPart = AveragePlayer:FindFirstChild("HumanoidRootPart") or AveragePlayer:FindFirstChild("Torso")

			if rootPart and plrRoot then
				rootPart.CFrame = plrRoot.CFrame
			end
			
			p.Character = AveragePlayer

			AveragePlayer.Parent = workspace
			AveragePlayer.Humanoid.DisplayName = "BrickBattler"
			oldchar:Destroy()
			stringv.Value = oldv
		end
	end)
end)

game.Players.PlayerRemoving:Connect(function(p)
	local stringv = p:WaitForChild("CurrentMorph")
	save(p,stringv.Value)
end)

Hope this works! Please let me know about any errors (if found)

EDIT 1: Fixed the issue of the character not teleporting to where the player is. :D

7 comments

0

Thanks, It works! but I manage to find some Issues though, The first Issue Is that the morph will go away when you leave the game, but It doesn't go away when you reset, the second Issue Is that that you will also go to the same position the morph Is when morphing Into a troll, and the 3rd Issue Is that I want Is to It gives you other trolls In the same cup, just In a RNG type

0

It should work.. have you turned on "Enable Studio Access to API Services"? If not, open your command bar, and type in "game.Players["yourplayername"]:Kick()", that should make sure to save it. as for the second one, I am updating the post now. For the third one, I am not sure what you mean.

0

Alright, updated the post! Change both of your current scripts with the new ones.

0

Alright, so I think Its nearly done, just there are I think 2 Issues: The first Issue Is that the morph will put you at the same position the morph Is, BUT only If the player leaves or reset, and the second Issue Is that I want the tool to randomly give you a morph Instead of giving you the same morph

0

Also for the 2nd Issue If you need more context: The script for the morph has a RNG script which lets you get 3 morphs In a RNG type thing or whatever, the script you have simply gives you the same troll, but overall It works!

0

Oh, I see! Can't believe I didn't get that! Anyhow, issue 2 is already fixed (positions when they leave wont save when you rejoin though, you can ask me if you want that), and I am editing the post for your last issue!

0

Update: Issue with the morph, now the Camera breaks after activating. Not sure how to fix, but will use seperate methods (so it may not work for you), updating post later.

This discussion is preserved as it was. New answers, comments, and votes are closed.