for i,v in pairs(game:GetService("Players"):GetChildren()) do v.PlayerGui:WaitForChild("ShopButton").Frame:TweenPosition(UDim2.new(0.397,0,1.1,0)) end
Player
object residing in the Players
service. Only Player
objects should be there.Instance:GetChildren()
on the Players
service, when you should be using Players:GetPlayers()
. This exclusively returns players and only players.LocalScript
, this won’t work since you’re trying to edit the PlayerGui
of another player. This is a thing to prevent exploiters from maliciously creating GuiObject
s inside a player.Script
, this wouldn’t work either, since the server can not access PlayerGui
. So what can you do? Seems like what you want to accomplish won’t work...RemoteEvent
and it should work.-- server Script under ServerScriptService local remote = Instance.new"RemoteEvent" remote.Name = "TweenAllGuis" remote.Parent = game:GetService"ReplicatedStorage" wait(.1) -- So the remote event has time to listen for OnClientEvent, else will error since the remote’s event wasn’t connected to a function. for _, v in pairs(game:GetService("Players"):GetPlayers()) do remote:FireClient(v) end
--LocalScript local rep = game:GetService"ReplicatedStorage" local plr = game:GetService("Players").LocalPlayer rep:WaitForChild("TweenAllGuis").OnClientEvent:Connect(function() plr:WaitForChild("PlayerGui").ShopGui.Frame:TweenPosition( --TweenPosition code here. ) end)
You don't use a WaitForChild for a GUI, add WaitForChild to .Frame