The title really says it for its self I’m not sure how to tween it.
You can’t tween a GUI
object (I swear I’m gonna get yelled at but I meant a BillboardGui/ScreenGui), but you can Tween the Frame
inside the GUI
object if that’s what you mean
I mean i Gui frame from the server, like it would turn night then it tweens down and shows all the players
Ah, you would use TweenPosition for that, there are a couple of things to note when using it:
- Parameter 1 is your UDim2 end position
- Parameter 2 is your
Enum
Easing Direction - Parameter 3 is your
Enum
Easing Style - Parameter 4 is the amount of time you want the tween to last
- Parameter 5 is if you want to override any other tweens (Or that one in particular)
- Parameter 6 is a
callback
function of some sort
Code Example maybe?
local GuiToTween = workspace.GuiThingy
if game.Lighting.ClockTime == 20 then
GuiToTween.Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 2)
end
it would show for all players?
If you’re wanting to do it on the server side, you’d need to have a Billboard/SurfaceGui of some sort
Doing it client-side however, you’ll probably need to use RemoteEvent’s FireAllClients()
function on the server if you want it to change for all players that are in the game rn
1.) You can’t tween a UI frame on someones client from the server.
2.) If you want to, you would need a remote event.
a.) Create RemoteEvent in ReplicatedStorage so both the client and server can access it.
b. Program
Server:
local RE = game.ReplicatedStorage:WaitForChild("RemoteEvent")
RE:FireClient() -- Or :FireAllClients() if you want this to happen for every player.
Client:
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
--do whatever you want with the UI here
end)
Also, no matter what, you need to specify your goal in your post. There is more than one type of Gui object, so please be more specific in the future. Hopefully this helps.
Hi, you won’t be able to tween a GUI using a server-side script.
However, you can do this using a RemoteEvent.
→ fire the Event with your server-side script
→ execute the tween in a local script when the Event is fired
Edit: It’s what @ Hyules said before.
Why are you trying to do Ui scripting on the server?
This would require the use of remote events but why not just a local script?
Basically what I want to do is, when it becomes night a gui goes down and says survive the night
For all clients?
Then I suggest you do a remote event and have the server fire it
Server:
local rep = game:GetSerVice("ReplicatedStorage")
local event = rep:FindFirstChild("RemoteEvent")
if game.Lighting.TimeOfDay == 12 then
event:FireAllClients()
end
local
local rep = game:GetSerVice("ReplicatedStorage")
local event = rep:FindFirstChild("RemoteEvent")
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer;
local Gui = localPlayer.PlayerGui.NightScreen
event.OnServerEvent:Connect(function()
Gui.Enabled = true -- or you can have a tween with a tween
end)
Since this is part Ui scripting put the local script in startergui
You cant possibly set an OnServerEvent command into a local script.