Hello!
So, I made a system where If you use a tool It will morph you Into a troll, however the morph will not go away If the user resets or rejoin
But the problem with the system Is:
- If you reset or rejoin, you will be teleported to the morphs location
- I want the system to be modify so that the system can tell what morph to give you (What I mean Is that If the player uses a tool, It was a 1/2 chance of giving you either a:
Rare or Common troll
If the system decides to give you a Common or Rare troll, It will need to select the said morph and give It to you)
Notes: The default player uses a custom default player, basically If you join, your a troll Instead of your usual avatar
The game.ReplicatedStorage.ExclusiveTrolls on both tool and ServerScriptService scripts are simply just a folder containing all the exclusive trolls, the main morph folder Is simply called:
"Morphs"
Script (ServerScriptService, Server-Side):
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["Sand:FB"]: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 = "Sand:FB"
oldchar:Destroy()
stringv.Value = oldv
end
end)
end)
game.Players.PlayerRemoving:Connect(function(p)
local stringv = p:WaitForChild("CurrentMorph")
save(p,stringv.Value)
end)

1 comment
i dont have time to read of script and idk the hierarchy of the files but instead of a new Character why not modify the current character