Hey there. This is pretty self explanatory. I have a small problem:
I changed some settings on my studio but I do not remember which ones. And because of that the buttons in studio seems to not work at all. The code is correct since it works in game:
Player:
Studio
If anyone has any clue or can help me re enable buttons in studio that would help greatly. Thanks
-- Services
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local Debris = game:GetService("Debris")
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local StarterGui = game:GetService("StarterGui")
local SoundService = game:GetService("SoundService")
-- Constants
local TweenInformations = {
Fade = TweenInfo.new()
}
local TweenGoals = {
FadeOut = {
TintColor = Color3.fromRGB()
},
FadeIn = {
TintColor = Color3.fromRGB(255,255,255)
}
}
-- Varables
local Character: Model | Folder
-- Objects
local EffectsModule = require(ReplicatedStorage.Modules.EffectsModule)
local SmoothCamera = require(script.SmoothCamera)
local MenuCamera = require(script.MainMenu)
-- References
local Camera = workspace.CurrentCamera
local Player = Players.LocalPlayer
local PlayerGui = Player.PlayerGui
local RqTeamChange = ReplicatedStorage.Remotes.Functions.RequestTeamChange
local RqDeploy = ReplicatedStorage.Remotes.Functions.RequestDeploy
local CharDiedEvent = Player.PlayerScripts:WaitForChild("CharacterDied")
local CharSpawnEvent = Player.PlayerScripts:WaitForChild("CharacterSpawned")
for i, v in ipairs(StarterGui:GetChildren()) do
v.Parent = PlayerGui
end
local TeamSelectionButtons = PlayerGui.Team.Selection.SelectionFrame:GetChildren()
Instance.new("ColorCorrectionEffect",Camera)
local FadeOutTween: Tween = TweenService:Create(Camera.ColorCorrection,TweenInformations.Fade,TweenGoals.FadeOut)
local FadeInTween: Tween = TweenService:Create(Camera.ColorCorrection,TweenInformations.Fade,TweenGoals.FadeIn)
-- Functions
-- Events
PlayerGui.Play.Start.MouseButton1Click:Connect(
function()
local Character = RqDeploy:InvokeServer(MenuCamera.SelectedCharacter)
if Character then
SoundService:PlayLocalSound(SoundService.ClientSFX.StartButton)
CharSpawnEvent:Fire(Character,MenuCamera.SelectedCharacter)
FadeOutTween:Play()
FadeOutTween.Completed:Wait()
MenuCamera:Term()
SmoothCamera:Init()
SmoothCamera.CameraSubject = Character.PrimaryPart
FadeInTween:Play()
else
SoundService:PlayLocalSound(SoundService.ClientSFX.Rejected)
print("Contact Developer Code: 1")
end
end
)
for i,v in ipairs(TeamSelectionButtons) do
if not v:IsA("GuiObject") then
table.remove(TeamSelectionButtons,i)
end
end
for i,Team in ipairs(TeamSelectionButtons) do
Team.MouseButton1Click:Connect(function()
for i,v in ipairs(TeamSelectionButtons) do
v.BackgroundColor3 = Color3.new(0.207843, 0.223529, 0.247059)
v.TextColor3 = Color3.new(0.647059, 0.764706, 0.866667)
end
Team.BackgroundColor3 = Color3.new(0.458824, 0.576471, 0.670588)
Team.TextColor3 = Color3.new(0.207843, 0.223529, 0.247059)
MenuCamera.Team = Teams[Team.Name]
end)
end
-- Init
MenuCamera:Init()
if RunService:IsStudio() then
local Changed: boolean = RqTeamChange:InvokeServer(Teams.Vindicroy)
if Changed then
local Character = ReplicatedStorage.Remotes.Functions.RequestDeploy:InvokeServer(1)
if Character then
Player.PlayerScripts.CharacterSpawned:Fire(Character,1)
MenuCamera:Term()
SmoothCamera:Init()
SmoothCamera.CameraSubject = Character.PrimaryPart
end
end
end
I don’t think the script needs fixing but I put it here anyways.