StarterCharacter

I need help with this.
Thanks.

LocalScript
local Player = game:GetService("Players").LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local StarterPlayer = game:GetService("StarterPlayer")

local Morph1 = RS.Morphs.Sushi
local Morph2 = RS.Morphs.Burger
local Morph3 = RS.Morphs.Ramen
local Morph4 = RS.Morphs.Pizza

local Button = script.Parent

local MorphPotion = Player.Backpack:WaitForChild("MorphPotion")

local Status = false

Button.MouseButton1Up:Connect(function()
	if Status == false then
		Status = true
		MorphPotion:Destroy()
		local TheNumber = 0
		local NewNumber = math.random(1,4)
		TheNumber = NewNumber
		if TheNumber == 1 then
			local newMorph1 = Morph1:Clone()
			newMorph1.Parent = StarterPlayer
			newMorph1.Name = "StarterCharacter"
			Button.Text = "20"
			wait(1)
			Button.Text = "19"
			wait(1)
			Button.Text = "18"
			wait(1)
			Button.Text = "17"
			wait(1)
			Button.Text = "16"
			wait(1)
			Button.Text = "15"
			wait(1)
			Button.Text = "14"
			wait(1)
			Button.Text = "13"
			wait(1)
			Button.Text = "12"
			wait(1)
			Button.Text = "11"
			wait(1)
			Button.Text = "10"
			wait(1)
			Button.Text = "9"
			wait(1)
			Button.Text = "8"
			wait(1)
			Button.Text = "7"
			wait(1)
			Button.Text = "6"
			wait(1)
			Button.Text = "5"
			wait(1)
			Button.Text = "4"
			wait(1)
			Button.Text = "3"
			wait(1)
			Button.Text = "2"
			wait(1)
			Button.Text = "1"
			wait(1)
			Button.Text = "0"
			newMorph1:Destroy()
			Button.Visible = false
			Button.Text = "Drink"
			Status = false
		elseif TheNumber == 2 then
			local newMorph2 = Morph2:Clone()
			newMorph2.Parent = StarterPlayer
			newMorph2.Name = "StarterCharacter"
			Button.Text = "20"
			wait(1)
			Button.Text = "19"
			wait(1)
			Button.Text = "18"
			wait(1)
			Button.Text = "17"
			wait(1)
			Button.Text = "16"
			wait(1)
			Button.Text = "15"
			wait(1)
			Button.Text = "14"
			wait(1)
			Button.Text = "13"
			wait(1)
			Button.Text = "12"
			wait(1)
			Button.Text = "11"
			wait(1)
			Button.Text = "10"
			wait(1)
			Button.Text = "9"
			wait(1)
			Button.Text = "8"
			wait(1)
			Button.Text = "7"
			wait(1)
			Button.Text = "6"
			wait(1)
			Button.Text = "5"
			wait(1)
			Button.Text = "4"
			wait(1)
			Button.Text = "3"
			wait(1)
			Button.Text = "2"
			wait(1)
			Button.Text = "1"
			wait(1)
			Button.Text = "0"
			newMorph2:Destroy()
			Button.Visible = false
			Button.Text = "Drink"
			Status = false
		elseif TheNumber == 3 then
			local newMorph3 = Morph3:Clone()
			newMorph3.Parent = StarterPlayer
			newMorph3.Name = "StarterCharacter"
			Button.Text = "20"
			wait(1)
			Button.Text = "19"
			wait(1)
			Button.Text = "18"
			wait(1)
			Button.Text = "17"
			wait(1)
			Button.Text = "16"
			wait(1)
			Button.Text = "15"
			wait(1)
			Button.Text = "14"
			wait(1)
			Button.Text = "13"
			wait(1)
			Button.Text = "12"
			wait(1)
			Button.Text = "11"
			wait(1)
			Button.Text = "10"
			wait(1)
			Button.Text = "9"
			wait(1)
			Button.Text = "8"
			wait(1)
			Button.Text = "7"
			wait(1)
			Button.Text = "6"
			wait(1)
			Button.Text = "5"
			wait(1)
			Button.Text = "4"
			wait(1)
			Button.Text = "3"
			wait(1)
			Button.Text = "2"
			wait(1)
			Button.Text = "1"
			wait(1)
			Button.Text = "0"
			newMorph3:Destroy()
			Button.Visible = false
			Button.Text = "Drink"
			Status = false
		elseif TheNumber == 4 then
			local newMorph4 = Morph4:Clone()
			newMorph4.Parent = StarterPlayer
			newMorph4.Name = "StarterCharacter"
			Button.Text = "20"
			wait(1)
			Button.Text = "19"
			wait(1)
			Button.Text = "18"
			wait(1)
			Button.Text = "17"
			wait(1)
			Button.Text = "16"
			wait(1)
			Button.Text = "15"
			wait(1)
			Button.Text = "14"
			wait(1)
			Button.Text = "13"
			wait(1)
			Button.Text = "12"
			wait(1)
			Button.Text = "11"
			wait(1)
			Button.Text = "10"
			wait(1)
			Button.Text = "9"
			wait(1)
  			Button.Text = "8"
			wait(1)
			Button.Text = "7"
			wait(1)
			Button.Text = "6"
 			wait(1)
			 Button.Text = "5"
			 wait(1)
 			Button.Text = "4"
			wait(1)
			Button.Text = "3"
			wait(1)
			Button.Text = "2"
			wait(1)
			Button.Text = "1"
			wait(1)
			Button.Text = "0"
			newMorph4:Destroy()
			Button.Visible = false
			Button.Text = "Drink"
			Status = false
		elseif TheNumber == 0 then
			print("Error or nothing...")
		end
	elseif Status == true then
		print("Wait...")
	end
end)

you must do it in the ServerSide instead, fire a remote to the server.

1 Like

You are not even explaining what the issue is all you did was post 2 images and say I need help!, Your title doesnt even tells us the issue its just Starter Character

Im trying to guess what you even want, Im guessing you have an issue with your morphing effect because it doesnt works?, first of all wheres the script to see the issue what even is the issue, and also if you are only using a local script this wont work as it needs to get replicated to other players, use a remote event to cominucate with the server so the server can run the morph code

6 Likes

When you drink the potion you become a player.

??? This isnt the script?, this is just a picture of where the script is alocated, what I mean is what is the code itself, like how are we even gonna help you.

1 Like
local script
morphs=game.ReplicatedStorage:FindFirstChild("morphs") or game.ReplicatedStorage:WaitForChild("morphs")
local morphs={
	morph1=morphs.ramen,
	morph2=morphs.sushi,
	morph3=morphs.burger,
	morph4=morphs.pizza
}
local debounce=false

script.Parent.MouseButton1Click:Connect(function()
	if debounce==true then return end
	local random=math.random(1,4)
	local morph=morphs["morph"..tostring(random)].Name
	game.ReplicatedStorage.RemoteEvent:FireServer(morph)
end)
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
	debounce=true
	workspace.Camera.CameraSubject=game.Players.LocalPlayer.Character.Humanoid
	workspace.Camera.CameraType=Enum.CameraType.Follow
	for i=20,0,-1 do
		script.Parent.Text=i
		wait(1)
	end
	debounce=false
end)
Server Script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,morph)
	local morph=game.ReplicatedStorage.morphs[morph]:Clone()
	morph.Parent=workspace
	morph.Name=plr.Character.Name
	morph.PrimaryPart.CFrame=plr.Character.PrimaryPart.CFrame
	morph.HumanoidRootPart.Anchored=false
	plr.Character=morph
	game.ReplicatedStorage.RemoteEvent:FireClient(plr)
end)
onClick

make a table of morphs

craete debounce

create onclick() and :onclientevent()

onclick of button check debounce if true return and do nothing

else

generate random number 1-4

random_number=math.random(1,4)

find the model inside model=RS.Morphs[morph…tostring(random_number)]

send the name of the chosen model to the server using fireserver of the remote event
send the name as an argument

–in server

onServerEvent

get the model using name from the event parameter
clone it
set parent of clone to workspace
set CFrame of the model’ primary part to CFrame of the player character’ primarypart
set the name of clone to the player character name
set anchored property of primary part of clone to false
set player.character=clone
invoke fireclient function of remote_event

–local script

onclient event

set debounce to true
set camera subject to character humanoid
set camera type to “ENUM follow”
iterate from i=20 to i=0 by -1 and set text to the value of i; wait 1 sec every iteration
after iteration finished
set debounce to false

something like this…

2 Likes