Idea: use euler angles instead for flashlight UDP, also brightness 1

This commit is contained in:
2024-03-02 03:20:21 -05:00
parent 0d08e341b2
commit b1bde56f5c
3 changed files with 9 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ function Actions:EnableFlashlight(FlashlightKey: Enum.KeyCode)
task.spawn(function() task.spawn(function()
while Actions.FlashlightEnabled do while Actions.FlashlightEnabled do
FlashlightRemote:FireServer(self.CurrentCamera.CFrame) FlashlightRemote:FireServer(table.pack(self.CurrentCamera.CFrame:ToEulerAnglesXYZ()))
Delta:time() Delta:time()
end end
end) end)

View File

@@ -10,6 +10,10 @@ type FlashlightUDP = RBXScriptConnection
type LocalPlayer = Player type LocalPlayer = Player
type HumanoidRootPart = BasePart type HumanoidRootPart = BasePart
type EulerXYZ_struct = {
[number | string]: number
}
Flashlight.Enabled = false Flashlight.Enabled = false
local CharacterShared = _G.include(script, "CharacterShared") local CharacterShared = _G.include(script, "CharacterShared")
@@ -49,9 +53,10 @@ function Flashlight.constructor(LocalPlayer: LocalPlayer, HumanoidRootPart: Huma
if FlashlightUDP_Event then if FlashlightUDP_Event then
warn("[Server Flashlight]: UDP event was already created, duplicating...", debug.traceback()) warn("[Server Flashlight]: UDP event was already created, duplicating...", debug.traceback())
end end
FlashlightUDP_Event = Flashlight_UDP.OnServerEvent:Connect(function(Messenger: Player, CameraCFrame: CFrame) FlashlightUDP_Event = Flashlight_UDP.OnServerEvent:Connect(function(Messenger: Player, CameraEuler: EulerXYZ_struct)
if Messenger.UserId == LocalPlayer.UserId then if Messenger.UserId == LocalPlayer.UserId then
FlashlightPart.CFrame = CameraCFrame -- FlashlightPart.CFrame = CameraCFrame
-- print((HumanoidRootPart.Position-CameraCFrame.Position).Magnitude)
end end
end) end)

View File

@@ -11,7 +11,7 @@ type LightingProps = { [string]: Color3 | number | boolean | string }
local Lighting_PropsTree: LightingProps = { local Lighting_PropsTree: LightingProps = {
["Ambient"] = Color3.fromRGB(40,40,40), ["Ambient"] = Color3.fromRGB(40,40,40),
["Brightness"] = 2, ["Brightness"] = 1,
["ColorShift_Bottom"] = Color3.new(0,0,0), ["ColorShift_Bottom"] = Color3.new(0,0,0),
["ColorShift_Top"] = Color3.new(0,0,0), ["ColorShift_Top"] = Color3.new(0,0,0),
["EnvironmentDiffuseScale"] = 1, ["EnvironmentDiffuseScale"] = 1,