Hello, my name is dog6779. This is my first time scripting.
Problem
I trying to make a Gui where it pops up but ONLY GROUP MEMBERS can only see it. But I want it where it does its animation. By the way, it is in a folder which I would be organized most of the time. As you can see the main:TweenPosition(UDim2.new(0.284, 0,0.201, 0), "Out","Bounce",0.5) that a animation to make where it get clicked then it pops up.
Script
game.Workspace.Computers.Computer1.Screen.ClickDetector.MouseClick:Connect(function(playerInGroup) game.Players.PlayerAdded:Connect(function(Player) if Player:GetRankinGroup(4222666) == 0 then if open == false then Player.PlayerGui.Main.Frame.Visible = false main:TweenPosition(UDim2.new(0.284, 0,0.201, 0), "Out","Bounce",0.5) if close == true then Player.PlayerGui.Main.Frame.Visible = true main:TweenPosition(UDim2.new(0.284, 0, 1, 0), "Out","Bounce",0.5) end end) end end) print("Frame Open!")
Please tell me what I do wrong?
MouseClick
inside the PlayerAdded
event. Not necessary. Also, you’re trying to modify PlayerGui
from the server, which is not good. Fire a RemoteEvent
to the client if they are in the group.-- Server Script, inside Workspace.Computers.Computer1.Screen local rep = game:GetService"ReplicatedStorage" local showGui = rep:WaitForChild"ShowGui" --RemoteEvent under ReplicatedStorage^ script.Parent.ClickDetector.MouseClick:Connect(function(plr) if plr:IsInGroup(4222666) then -- instead of checking the rank, check if they’re in the group showGui:FireClient(plr) end end)
--LocalScript, under PlayerGui.Main.Frame local rep = game:GetService"ReplicatedStorage" local showGui = rep:WaitForChild"ShowGui" local out = Enum.EasingDirection.Out local bounce = Enum.EasingStyle.Bounce --Use Enum’s instead of strings showGui.OnClientEvent:Connect(function() script.Parent.Visible = true script.Parent:TweenPosition( UDim2.new(.284, 0, 1, 0), out, bounce, 0.5 ) end)