#Viewport frame not updating with skin change

9 messages · Page 1 of 1 (latest)

sick cloud
#

I have a gui where I can change the skin of characters but when it changes this viewport will not display the new color! can anyone help?

#
local uis = game:GetService("UserInputService")

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local MouseInDisplay, HoldInDisplay = false, false

local currentX

-- Character Display
local VPFcam = Instance.new("Camera"); VPFcam.Parent = script.Parent.ViewportFrame
VPFcam.CFrame = CFrame.new(0,0,0)
script.Parent.ViewportFrame.CurrentCamera = VPFcam

repeat wait(.1) until game:IsLoaded()

char.Archivable = true

local ClonedChar = char:Clone()

ClonedChar.Parent = script.Parent.ViewportFrame.WorldModel
ClonedChar.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
ClonedChar:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0,0,-9.5),Vector3.new(0,0,0)))

-- Turning Feature
uis.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        if MouseInDisplay == true then
            HoldInDisplay = true
            currentX = nil
        end
    end
end)

uis.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        HoldInDisplay = false
    end
end)

script.Parent.ViewportFrame.MouseMoved:Connect(function(X,Y)

    if HoldInDisplay == false then return end

    if currentX then ClonedChar.PrimaryPart.CFrame *= CFrame.fromEulerAnglesXYZ(0,((X-currentX)*.025),0) end

    currentX = X
end)

script.Parent.ViewportFrame.MouseEnter:Connect(function() MouseInDisplay = true end)
script.Parent.ViewportFrame.MouseLeave:Connect(function() MouseInDisplay = false end)

script.Parent.skinPanel.savebtn.MouseButton1Click:Connect(function()
    local root = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
    root.Size = Vector3.new(2, 2, 2)
    wait(.5)
    root.Size = Vector3.new(2, 2, 1)
end)```
torn wren
#

im gonna be honest this script is too long for me to read

#

but i think that i already know the problem

#

you only update the color of the skin for the player

#

and not also for the clone that you put inside of the viewport

#

brother your script is messy

#

you're allowed to use spaces

#

instead of doing this for example
script.Parent.ViewPortFrame.MouseEnter:Connect(function() MouseInDisplay = true end)