This Script is a local script that would control camera manipulation and other things but i want if the camera.focus = Cam1 then the Player’s Character Changes to HuggyWuggy(Example)
local camera = workspace.CurrentCamera
local Cam1 = game.Workspace.Cam1.CFrame
local Cam2 = game.Workspace.Cam2.CFrame
local Scroll = game.Players.LocalPlayer.PlayerGui:WaitForChild("Scroll")
local Main = game.Players.LocalPlayer.PlayerGui:WaitForChild("menu")
local Left = Scroll.Left
local Right =Scroll.Right
local Play = Scroll.Play
local Player = game.Players.LocalPlayer
local CharacterMorph = game.ReplicatedStorage.CharacterMorph
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Cont.Visible = false
script.Parent.Parent.Parent.startframe.Visible = false
script.Parent.Parent.Parent.startframe.startframe.Visible = false
camera.CameraType = "Fixed"
camera.Focus = Cam1
Left.Visible = true
Right.Visible = true
Scroll.Play.Visible = true
end)
Right.MouseButton1Click:Connect(function()
camera.Focus = Cam2
end)
Left.MouseButton1Click:Connect(function()
camera.Focus = Cam1
end)
Play.MouseButton1Click:Connect(function()
Main.main.Visible = false
Scroll.Left.Visible = false
Scroll.Right.Visible = false
Scroll.Play.Visible = false
camera.CameraType = "Follow"
end)
if camera.Focus == Cam1 then
Play.MouseButton1Click:Connect(function()
Player.Character = workspace.HuggyWuggy
end)
end
You’re declaring player.Character as a new thing, not setting the actual player’s character to a model.
It’s probably not an issue, but, the script is a localscript. If you want other players to see the player’s new character model, then you should probably fire a RemoteEvent, then change the player’s character model
Create a new script(not a localscript) in ServerScriptService, and name it however you want.
Create a new RemoteEvent in ReplicatedStorage, and name it ChangeCharacter
Inside the script, paste the following:
local repStorage = game:GetService("ReplicatedStorage")
local model = repStorage.HuggyWuggy -- place the model into the ReplicatedStorage
local event = repStorage.ChangeCharacter
event.OnServerEvent:Connect(function(player)
local oldChr = player.Character
local newChr = model:Clone()
newChr.HumanoidRootPart.Anchored = false -- assuming that you have an HRP inside the model
newChr:SetPrimaryPartCFrame(oldChr.PrimaryPart.CFrame)
end)
player.Character = newChr
newChr.Parent = game:GetService("Workspace")
Then, paste the following in the current LocalScript you have:
(changes at the bottom)
local camera = workspace.CurrentCamera
local Cam1 = game.Workspace.Cam1.CFrame
local Cam2 = game.Workspace.Cam2.CFrame
local Scroll = game.Players.LocalPlayer.PlayerGui:WaitForChild("Scroll")
local Main = game.Players.LocalPlayer.PlayerGui:WaitForChild("menu")
local Left = Scroll.Left
local Right =Scroll.Right
local Play = Scroll.Play
local Player = game.Players.LocalPlayer
local CharacterMorph = game.ReplicatedStorage.CharacterMorph
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Cont.Visible = false
script.Parent.Parent.Parent.startframe.Visible = false
script.Parent.Parent.Parent.startframe.startframe.Visible = false
camera.CameraType = "Fixed"
camera.Focus = Cam1
Left.Visible = true
Right.Visible = true
Scroll.Play.Visible = true
end)
Right.MouseButton1Click:Connect(function()
camera.Focus = Cam2
end)
Left.MouseButton1Click:Connect(function()
camera.Focus = Cam1
end)
Play.MouseButton1Click:Connect(function()
Main.main.Visible = false
Scroll.Left.Visible = false
Scroll.Right.Visible = false
Scroll.Play.Visible = false
camera.CameraType = "Follow"
end)
if camera.Focus == Cam1 then
Play.MouseButton1Click:Connect(function()
repStorage.ChangeCharacter:FireServer()
end)
end