local Players = game:GetService("Players")
local player = Players.LocalPlayer
local TweenService = game:GetService("TweenService")
local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
local Name = script.Parent.WelcomeFrame.plrname
local icon = script.Parent.WelcomeFrame.Plricon
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local looking = false
local endCFrame = CFrame.new(game.Workspace.test.Position) --> put the CFrame of where you want the camera to end up here
local tweentime = 2
local debouncetime = 0.5
local active = false
local event = game.ReplicatedStorage.test
event.OnClientEvent:Connect(function(plr)
if active then return end active = true
looking = not looking
if looking then
camera.CameraType = Enum.CameraType.Scriptable
game.TweenService:Create(camera, TweenInfo.new(tweentime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out,0,false,0), {CFrame = endCFrame}):Play()
wait(tweentime+debouncetime)
else
camera.CameraType = Enum.CameraType.Custom
wait(debouncetime)
end
active = false
end)
-- Welcome Frame Variables
local WelcomeFrame = script.Parent.WelcomeFrame
local HomeBTN = WelcomeFrame.HomeBTN
local Logo = WelcomeFrame.Logo
local plricon = WelcomeFrame.Plricon
local thing = WelcomeFrame.Thing
local lang = WelcomeFrame.Language
local pname = WelcomeFrame.plrname
-- Welcome Frame Variables
-- Home Frame Variables
local homefram = script.Parent.HomeFrame
local CheckBTN = homefram.CheckBTN
local Thng1 = homefram.CheckBTN.thng
local FiBTN = homefram.FiBTN
local Thng2 = homefram.FiBTN.thng
local Bc2 = homefram.BackGround2
local name1 = homefram.BackGround2.es
local descp1 = homefram.BackGround2.descp
local Bc = homefram.BackGround
local name2 = homefram.BackGround.es
local descp2 = homefram.BackGround.Descp
local logos = homefram.Logo
-- Home Frame Variables
local tweenInfo = TweenInfo.new(
3, -- Time
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local tweenInfo2 = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
-- Welcome Frame Tweens
local tween2 = TweenService:Create(Logo, tweenInfo, {ImageTransparency = 1})
local tween3 = TweenService:Create(thing, tweenInfo, {ImageTransparency = 1})
local tween4 = TweenService:Create(lang, tweenInfo, {TextTransparency = 1})
local tween5 = TweenService:Create(pname, tweenInfo, {TextTransparency = 1})
local tween6 = TweenService:Create(HomeBTN, tweenInfo, {TextTransparency = 1})
local tween7 = TweenService:Create(plricon, tweenInfo, {ImageTransparency = 1})
local tween8 = TweenService:Create(plricon, tweenInfo, {BackgroundTransparency = 1})
-- Welcome Frame Tweens
-- Home Frame Tween
local tween10 = TweenService:Create(logos, tweenInfo, {ImageTransparency = 0})
local tween11 = TweenService:Create(Bc, tweenInfo, {ImageTransparency = 0})
local tween12 = TweenService:Create(Bc2, tweenInfo, {ImageTransparency = 0})
local tween13 = TweenService:Create(name1, tweenInfo, {TextTransparency = 0})
local tween14 = TweenService:Create(descp1, tweenInfo, {TextTransparency = 0})
local tween15 = TweenService:Create(name2, tweenInfo, {TextTransparency = 0})
local tween16 = TweenService:Create(descp2, tweenInfo, {TextTransparency = 0})
local tween19 = TweenService:Create(FiBTN, tweenInfo, {BackgroundTransparency = 1})
local tween20 = TweenService:Create(CheckBTN, tweenInfo, {BackgroundTransparency = 1})
local tween21 = TweenService:Create(FiBTN, tweenInfo, {BackgroundTransparency = 1})
local tween22 = TweenService:Create(Thng1, tweenInfo, {TextTransparency = 1})
local tween23 = TweenService:Create(Thng2, tweenInfo, {TextTransparency = 1})
-- seperate
local tweencool = TweenService:Create(FiBTN, tweenInfo2, {BackgroundTransparency = 1})
local tweenverycool = TweenService:Create(Thng1, tweenInfo2, {TextTransparency = 1})
local tweencool2 = TweenService:Create(CheckBTN, tweenInfo2, {BackgroundTransparency = 1})
local tweenverycool2 = TweenService:Create(Thng2, tweenInfo2, {TextTransparency = 1})
local tweencool3 = TweenService:Create(FiBTN, tweenInfo2, {BackgroundTransparency = 0.5})
local tweenverycool3 = TweenService:Create(Thng1, tweenInfo2, {TextTransparency = 0})
local tweencool4 = TweenService:Create(CheckBTN, tweenInfo2, {BackgroundTransparency = 0.5})
local tweenverycool4 = TweenService:Create(Thng2, tweenInfo2, {TextTransparency = 0})
-- Home Frame Tween
-- Random Stuff
icon.Image = content
Name.Text = player.Name
-- Random Stuff
CheckBTN.MouseEnter:Connect(function()
tweencool4:Play()
tweenverycool3:Play()
end)
CheckBTN.MouseLeave:Connect(function()
tweencool2:Play()
tweenverycool:Play()
end)
FiBTN.MouseEnter:Connect(function()
tweencool3:Play()
tweenverycool4:Play()
end)
FiBTN.MouseLeave:Connect(function()
tweencool:Play()
tweenverycool2:Play()
end)
-- HomeBTN
script.Parent.WelcomeFrame.HomeBTN.MouseButton1Click:Connect(function()
tween2:Play()
tween3:Play()
tween5:Play()
tween4:Play()
tween6:Play()
tween7:Play()
tween8:Play()
wait(3)
WelcomeFrame.Visible = false
homefram.Visible = true
wait(1)
tween10:Play()
tween11:Play()
tween12:Play()
tween13:Play()
tween14:Play()
tween15:Play()
tween16:Play()
tween23:Play()
tween22:Play()
tween19:Play()
tween20:Play()
print("works perfectly fine")
end)
-- HomeBTN
You have WAAAAAAY too MANY variables, remove MOST of them like the UserId that doesn’t need to be as a variable, and the 2 under It and ALOT are the exact same.
And your tweens, try to combine them.
how lol im not a pro script … tried to search but cant seem to find
Make a table and then use for loop
Can you give me an example script?
Smthing like this?
for _, part in pairs(workspace.Model:GetChildren()) do -- loop through all the children
for _, info in pairs(Info) do
for _, goal in pairs(Goals) do
TweenService:Create(part, Info, Goals)
end
end
end
There is also smthing similar to ur problem
How do I do it with different transparency properties like imagetransparency, texttransparency, backgroundtransparency liek that
?
local Goals = {
ImageTransparency = 1,
texttransparency = 1
}
here is an example
TweenService:Create(Part/AnyObject/Frame, ImageTransparency/Any properties inside the Part/Frame/AnyObject, 1) -- 1 is the Goal
can i put many properties in that script? also do i need to get the children of the frame?
Is this script right?
local TweenService = game:GetService("TweenService")
local Goals = {
ImageTransparency = 1,
texttransparency = 1
}
local tweenInfo = TweenInfo.new(
3, -- Time
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
HomeBTN.MouseButton1Click:connect(function()
for _, frame in pairs(WelcomeFrame:GetChildren()) do
TweenService:Create(frame, tweenInfo, Goals)
end
end)
You should try it and see if it is right
Like this
local tween7 = TweenService:Create(plricon, tweenInfo, {ImageTransparency = 1})
local tween8 = TweenService:Create(plricon, tweenInfo, {BackgroundTransparency = 1})
They are on the same object so do this
local tween7 = TweenService:Create(plricon, tweenInfo, {ImageTransparency = 1; BackgroundTransparency = 1})
This doesnt work shows an error that its not a property bla bla bl
Alright thank you very much! Very helpful
But im still finding some solution that will make my script really short
Because “Goals” isn’t a property, it’s a table. Replace your code with this,
for i, frame in pairs(WelcomeFrame:GetChildren()) do
TweenService:Create(frame, tweenInfo, Goals[i])
end
Use this code, I wrote this on phone so fix all the stuff, I just made it smaller without changing alot.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local TweenService = game:GetService("TweenService")
local content, isReady = Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
local WelcomeFrame = script.Parent.WelcomeFrame
local HomeBTN = WelcomeFrame.HomeBTN
local Logo = WelcomeFrame.Logo
local thing = WelcomeFrame.Thing
local lang = WelcomeFrame.Language
local Name = WelcomeFrame.plrname
local icon = script.Parent.WelcomeFrame.Plricon
local homefram = script.Parent.HomeFrame
local CheckBTN = homefram.CheckBTN
local Thng1 = homefram.CheckBTN.thng
local FiBTN = homefram.FiBTN
local Thng2 = homefram.FiBTN.thng
local Bc2 = homefram.BackGround2
local name1 = homefram.BackGround2.es
local descp1 = homefram.BackGround2.descp
local Bc = homefram.BackGround
local name2 = homefram.BackGround.es
local descp2 = homefram.BackGround.Descp
local logos = homefram.Logo
local camera = workspace.CurrentCamera
local looking = false
local endCFrame = CFrame.new(game.Workspace.test.Position)
local tweentime = 2
local debouncetime = 0.5
local active = false
local event = game.ReplicatedStorage.test
event.OnClientEvent:Connect(function(plr)
if active then return end
active = true
looking = not looking
if looking then
camera.CameraType = Enum.CameraType.Scriptable
game.TweenService:Create(camera, TweenInfo.new(tweentime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out,0,false,0), {CFrame = endCFrame}):Play()
wait(tweentime+debouncetime)
else
camera.CameraType = Enum.CameraType.Custom
wait(debouncetime)
end
active = false
end)
local tweenInfo = TweenInfo.new(
3, -- Time
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local tweenInfo2 = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local tween2 = TweenService:Create(Logo, tweenInfo, {ImageTransparency = 1})
local tween3 = TweenService:Create(thing, tweenInfo, {ImageTransparency = 1})
local tween4 = TweenService:Create(lang, tweenInfo, {TextTransparency = 1})
local tween5 = TweenService:Create(pname, tweenInfo, {TextTransparency = 1})
local tween6 = TweenService:Create(HomeBTN, tweenInfo, {TextTransparency = 1})
local tween7 = TweenService:Create(plricon, tweenInfo, {ImageTransparency = 1; BackgroundTransparency = 1})
local tween10 = TweenService:Create(logos, tweenInfo, {ImageTransparency = 0})
local tween11 = TweenService:Create(Bc, tweenInfo, {ImageTransparency = 0})
local tween12 = TweenService:Create(Bc2, tweenInfo, {ImageTransparency = 0})
local tween13 = TweenService:Create(name1, tweenInfo, {TextTransparency = 0})
local tween14 = TweenService:Create(descp1, tweenInfo, {TextTransparency = 0})
local tween15 = TweenService:Create(name2, tweenInfo, {TextTransparency = 0})
local tween16 = TweenService:Create(descp2, tweenInfo, {TextTransparency = 0})
local tween20 = TweenService:Create(CheckBTN, tweenInfo, {BackgroundTransparency = 1})
local tween21 = TweenService:Create(FiBTN, tweenInfo, {BackgroundTransparency = 1})
local tween22 = TweenService:Create(Thng1, tweenInfo, {TextTransparency = 1})
local tween23 = TweenService:Create(Thng2, tweenInfo, {TextTransparency = 1})
local tweencool = TweenService:Create(FiBTN, tweenInfo2, {BackgroundTransparency = 1})
local tweenverycool = TweenService:Create(Thng1, tweenInfo2, {TextTransparency = 1})
local tweencool2 = TweenService:Create(CheckBTN, tweenInfo2, {BackgroundTransparency = 1})
local tweenverycool2 = TweenService:Create(Thng2, tweenInfo2, {TextTransparency = 1})
local tweencool3 = TweenService:Create(FiBTN, tweenInfo2, {BackgroundTransparency = 0.5})
local tweenverycool3 = TweenService:Create(Thng1, tweenInfo2, {TextTransparency = 0})
local tweencool4 = TweenService:Create(CheckBTN, tweenInfo2, {BackgroundTransparency = 0.5})
local tweenverycool4 = TweenService:Create(Thng2, tweenInfo2, {TextTransparency = 0})
icon.Image = content
Name.Text = player.Name
CheckBTN.MouseEnter:Connect(function()
tweencool4:Play()
tweenverycool3:Play()
end)
CheckBTN.MouseLeave:Connect(function()
tweencool2:Play()
tweenverycool:Play()
end)
FiBTN.MouseEnter:Connect(function()
tweencool3:Play()
tweenverycool4:Play()
end)
FiBTN.MouseLeave:Connect(function()
tweencool:Play()tweenverycool2:Play()
end)
script.Parent.WelcomeFrame.HomeBTN.MouseButton1Click:Connect(function()
tween2:Play()
tween3:Play()
tween5:Play()
tween4:Play()
tween6:Play()
tween7:Play()
tween8:Play()
wait(3)
WelcomeFrame.Visible = false
homefram.Visible = true
wait(1)
tween10:Play()
tween11:Play()
tween12:Play()
tween13:Play()
tween14:Play()
tween15:Play()
tween16:Play()
tween23:Play()
tween22:Play()
tween19:Play()
tween20:Play()
print("works perfectly fine")
end)