Hello,
I am working on a camera system for my game, and I am making it so when a value is true, the power will go down. I tried this scripts below, and nothing happens. I am really blanking and any help would be appreciated.
local script:
local UserInputService = game:GetService('UserInputService')
local Camera = workspace.CurrentCamera
local Views = workspace:WaitForChild("Views")
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
local player = game:GetService('Players').LocalPlayer
local Frame = script.Parent
local deb = false
local on = false
UserInputService.InputBegan:Connect(function(input, gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.Space then
if Frame.Enabled == true then
if Frame.back.Visible == true then
Frame.back.Visible = false
Frame.ViewportFrame.Visible = true
end
Frame.Enabled = false
Frame.Parent.View.Enabled = true
on = true
game:GetService('ReplicatedStorage').OnCamera:FireServer(on)
elseif Frame.Enabled == false then
Frame.Enabled = true
on = false
game:GetService('ReplicatedStorage').OnCamera:FireServer(on)
end
end
end)
server script:
local value = workspace.OnCamera
local player
game.Players.PlayerAdded:Connect(function(Player)
player = Player
end)
game:GetService('ReplicatedStorage').OnCamera.OnServerEvent:Connect(function(on)
if on == true then
value.Value = true
elseif on == false then
value.Value = false
end
end)
while value.Value == true do
player.PlayerGui.MainUI.TextLabel.Value.Value -= 1
print(player.PlayerGui.MainUI.TextLabel.Value.Value)
end
Thanks in advanced!