Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Morph GUI camera is scuffed? Why?

Asked by 2 years ago
Edited 2 years ago

I made a gui that you can click and changes you into another character, it works on Roblox Studio playtest but when you join the actual game on roblox website your camera is scuffed. It makes no errors so I'm confused

First here is the local script in the gui

local   Characters = game:GetService("ReplicatedStorage").Characters
local   Event = game:GetService("ReplicatedStorage").ChooseCharacter

for i,v in pairs (script.Parent:GetChildren()) do
    if v:IsA("TextButton") or v:IsA("ImageButton") then
        v.MouseButton1Click:connect(function()
            if Characters:FindFirstChild(v.Name) then
                Event:FireServer(v.Name)
            elseif v.Name == "PlayerCharacter" then
                Event:FireServer("PlayerCharacter")
            end
        end)
    end
end

and here is the script in serverscriptservice

local   Characters = game:GetService("ReplicatedStorage").Characters
local   Event = game:GetService("ReplicatedStorage").ChooseCharacter

Event.OnServerEvent:connect(function(player,character)
    if character == "PlayerCharacter" then
        player:LoadCharacter()
    else
        local char = Characters[character]:Clone()
        local humapos = player.Character.HumanoidRootPart.Position
        char.Name = player.Name
        player:LoadCharacter()
        player.Character = char
        player.Character.Parent = workspace
        wait(.025)
        player.Character.HumanoidRootPart.Position = humapos
    end
end)

here is a picture https://imgur.com/a/iPvYolF here is another picture of what its like in the game https://imgur.com/a/6Lxl6SC Please help, if you answer I will immediately accept your answer (if it works)

0
Can you send a pic showing what it looks like when you play the actual game? sne_123456 439 — 2y
0
k Agent_EpicNoob 71 — 2y
0
done Agent_EpicNoob 71 — 2y
0
hi agent, can you send me a link to the game? sne_123456 439 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Hello, I am not 100% sure what's going wrong here but you can confirm the camera type is custom by having this script:

-- MAKE SURE TO PUT THIS SCRIPT IN A LOCALSCRIPT AND IN STARTERPACK!!!

local Camera = workspace.CurrentCamera

while true do
  Camera.CameraType = Enum.CameraType.Custom
  wait()
end

This code makes sure that your camera is the default roblox camera "custom"

Ad

Answer this question