Hello
im making a game where when you trigger a prompt to open a door, a screen gui slowly appears with tweening to transparency 0 but i want to make that screen gui visible for everyone and when i script it, only the player that use the prompt on the door have that screen gui thats not what i want
You can try using a server script, loop through all of the players’ PlayerGuis and do the tween on the ScreenGuis
How can i get all players guis i cant understand
just use the Player.PlayerGui
from there go to the gui
you get players with game:GetService("Players"):GetPlayers()
Loop through all the players and get their PlayerGuis
for i, player in game.Players:GetPlayers() do
local PlayerGui = player.PlayerGui
— get location of ScreenGui and tween it
end
it keeps working on only one player
heres the script :
local ts = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(2)
local Gui = script.Parent.Frame
local prompt = game.Workspace.Door1HV1.Door.ProximityPrompt
prompt.Triggered:Connect(function()
wait(1)
for i, player in game.Players:GetPlayers() do
local PlayerGui = player.PlayerGui
ts:Create(Gui, tweeninfo, {BackgroundTransparency = 0}):Play()
end
end)
You need to access the object you want to get for every player’s PlayerGui, not just the one the script is parented to
Can you send the full path of where script.Parent.Frame
is in StarterGui?
game.StarterGui.ScreenGuiV1.Frame
Thanks. You can do this:
prompt.Triggered:Connect(function()
wait(1)
for i, player in game.Players:GetPlayers() do
local PlayerGui = player.PlayerGui
local Frame = PlayerGui.ScreenGuiV1.Frame — get frame from each player
ts:Create(Frame, tweeninfo, {BackgroundTransparency = 0}):Play()
end
end)
It should work now
I’d advise against animating client’s UI on the server. Instead fire an event to all players and animate it through a client script.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.