For some reason, when I play my game with 2 or more players, there is an invisible ghost gui floating in workspace?
HIERARCHY: (3dGuiManager is a script inside StarterCharacterScripts)
3dGuiManager
local TweenService = game:GetService("TweenService")
local character = script.Parent
local touchModeGui = script:WaitForChild("TouchMode")
local angleBarGui = script:WaitForChild("AngleBar")
touchModeGui.Parent = character
touchModeGui.Enabled = true
angleBarGui.Parent = character
angleBarGui.Enabled = true
AngleDisplayManager
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local touchUtils = require(ReplicatedStorage.ModuleScripts.TouchUtils)
local localPlayer = Players.LocalPlayer
local backgroundFrame = script.Parent
local fillFrame = backgroundFrame:WaitForChild("Fill")
local function updateAngleBarDisplay(deltaTimeSim: number)
TweenService:Create(fillFrame, TweenInfo.new(0.1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {Size = UDim2.new(1, 0, (touchUtils:getAngle()) / 27.5, 0)}):Play()
end
RunService.PreSimulation:Connect(updateAngleBarDisplay)
ModeDisplayManager
local TweenService = game:GetService("TweenService")
local SoundService = game:GetService("SoundService")
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local backgroundFrame = script.Parent
local modeLabel = backgroundFrame:WaitForChild("Mode")
local switchSound = SoundService:WaitForChild("GuiSounds"):WaitForChild("Switch")
local function onTouchModeChanged()
modeLabel.Text = string.upper(tostring(localPlayer:GetAttribute("TouchMode")))
backgroundFrame.BackgroundColor3 = Color3.new(1, 1, 1)
backgroundFrame.BackgroundTransparency = 0.25
TweenService:Create(backgroundFrame, TweenInfo.new(1.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.new(0, 0, 0)}):Play()
TweenService:Create(backgroundFrame, TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 0.75}):Play()
switchSound:Play()
end
localPlayer:GetAttributeChangedSignal("TouchMode"):Connect(onTouchModeChanged)