take a look at this video here, this showcases the outcome of my scripts, and, how it's a problem. it also details some other stuff so thats important

here's the important parts of the script:

character_change (located in ServerScriptService) - serverscript

local characterpart = workspace:FindFirstChild("characterpart")
local basehumanoid = game.StarterPlayer.StarterHumanoid
local startercharacterscripts = game.StarterPlayer.StarterCharacterScripts
local serverstorage = game:GetService("ServerStorage")
local replicatedstorage = game:GetService("ReplicatedStorage")
local cameraevent = Instance.new("RemoteEvent", replicatedstorage)
cameraevent.Name = "cameraevent"
local touchbool = false

local function onTouch(otherpart)
	if otherpart.Parent:FindFirstChild("Humanoid") ~= nil and touchbool == false then
		local players = game.Players:GetPlayers()
		local playername = otherpart.Parent.Name
		local player = game.Players:FindFirstChild(playername)
		touchbool = true
		
		local newchara = serverstorage:FindFirstChild("Chara"):Clone()
		newchara.Name = player.Name
		newchara.Parent = workspace
		newchara:MoveTo(game.Players:FindFirstChild(playername).Character:FindFirstChild("HumanoidRootPart").Position)
		local newhumanoid = basehumanoid:Clone()
		newhumanoid.Parent = newchara
		newhumanoid.Name = "Humanoid"
		local newscripts = startercharacterscripts:GetChildren()
		for i = 1, #newscripts do
			local f = newscripts[i]:Clone()
			f.Parent = newchara
		end
		local oldchara = player.Character
		player.Character = nil
		print(oldchara)
		player.Character = newchara
		
		cameraevent:FireClient(player, newchara)
		--cameraevent:FireClient(player)
		wait(1)
		touchbool = false
	end
end
characterpart.Touched:Connect(onTouch)

controls_overworld (located in PlayerScripts) - localscript

local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cameraevent = ReplicatedStorage:WaitForChild("cameraevent")

local function camerafocus(charactermodel)
	print(charactermodel)
	local camera = workspace.CurrentCamera
	camera.CameraSubject = player.Character:FindFirstChild("Humanoid")
	--wait(1.5)
	print(player.Character)
end
cameraevent.OnClientEvent:Connect(camerafocus)

2 comments

0

Please watch your language. This is supposed to be a child friendly site.

0

oh, sorry, i didn't think 'hell' would've been interpreted as non-child friendly