Hello Developers!
I am having trouble with my script. So, what happened. This script has MANY things that don’t apply to this problem, cause it is a BIG script. So, recently, I added a popup that pops up when you click the kid, adult, or parent button. The popup worked, but it didn’t pop up on command, and when I added it to fire on command, it didn’t do it, instead, the whole script isn’t working. (Cutscene not working now.)
I just added the MainPopup
as a variable, made it appear when the player clicks one of the buttons and the script suddenly stopped working.
Here is the script:
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local Camera = Workspace.CurrentCamera
local CameraFolder = Workspace:FindFirstChild("CameraParts")
local TweenInfo = TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
local Blur = Lighting:WaitForChild("Blur")
local Events = ReplicatedStorage:WaitForChild("Events")
local TeamEvent = Events:WaitForChild("Team")
local Sp = script.Parent
local TeamSelector = Sp:WaitForChild("TeamSelectorEvent")
local Frame = Sp:WaitForChild("Frame")
local PlayerGui = Sp.Parent
local MainPopup = PlayerGui.MainMenu
MainPopup.Frame.Visible = false
local Tween = nil
local In_Mode = false
function Satrt()
if (In_Mode) then
return
end
In_Mode = true
Blur.Size = 24
Frame.Visible = true
Camera.CFrame = CameraFolder["1"].CFrame
local function Move(Num)
repeat Camera.CameraType = Enum.CameraType.Scriptable until
Camera.CameraType == Enum.CameraType.Scriptable
if (Frame.Visible == false) then
return
end
if not (CameraFolder:FindFirstChild(tostring(Num))) then
Num = 2
end
Tween = TweenService:Create(Camera, TweenInfo, {CFrame = CameraFolder[Num].CFrame})
Tween.Completed:Connect(function()
Move(Num + 1)
end)
Tween:Play()
end
Move(2)
end
function Close()
Frame.Visible = false
if (Tween) then
Tween:Cancel()
end
Blur.Size = 0
game.StarterGui.RoleplayName.Enabled = true
game.StarterGui.Main.Enabled = true
PlayerGui.Main.Enabled = true
Camera.CameraType = Enum.CameraType.Custom
In_Mode = false
end
Frame:WaitForChild("Kid").MouseButton1Click:Connect(function()
TeamEvent:FireServer("Kid")
Close()
MainPopup.Frame.Visible = true
wait(5)
player.Character.Humanoid.HeadScale.Value = 0.5
player.Character.Humanoid.BodyDepthScale.Value = 0.5
player.Character.Humanoid.BodyWidthScale.Value = 0.5
player.Character.Humanoid.BodyHeightScale.Value = 0.5
end)
Frame:WaitForChild("Adult").MouseButton1Click:Connect(function()
TeamEvent:FireServer("Adult")
Close()
MainPopup.Frame.Visible = true
wait(5)
player.Character.Humanoid.HeadScale.Value = 1
player.Character.Humanoid.BodyDepthScale.Value = 1
player.Character.Humanoid.BodyWidthScale.Value = 1
player.Character.Humanoid.BodyHeightScale.Value = 1
end)
Frame:WaitForChild("Parent").MouseButton1Click:Connect(function()
TeamEvent:FireServer("Parent")
Close()
MainPopup.Frame.Visible = true
wait(5)
player.Character.Humanoid.HeadScale.Value = 1
player.Character.Humanoid.BodyDepthScale.Value = 1
player.Character.Humanoid.BodyWidthScale.Value = 1
player.Character.Humanoid.BodyHeightScale.Value = 1
end)
TeamSelector.Event:Connect(function()
Satrt()
end)
Satrt()