Basically I sent the remote event and I know thats working, is there anything wrong in this script??
debounce = false local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = Players.LocalPlayer local GuiClicker = ReplicatedStorage:WaitForChild("GuiClicker") local playerGui = player:WaitForChild("PlayerGui") local function OnGuiClickerFired(plr) if debounce == false then plr.playerGui.InfoPanel.ScrollingFrame:TweenPosition(UDim2.new(0.5, -250,0.5, -200, 'Out', 'Bounce', 1)) debounce = true else plr.playerGui.InfoPanel.ScrollingFrame:TweenPosition(UDim2.new(-0.5, -250,0.5, -200, 'Out', 'Bounce', 1)) debounce = false plr.playerGui.InfoPanel.ScrollingFrame.Visible = true debounce = false end end GuiClicker.OnClientEvent:Connect(OnGuiClickerFired)
The first parameter of OnClientEvent is not the player, as you can just get the player through game.Players.LocalPlayer
in a LocalScript. However, when you fire a remote event to the server, the server doesn't know which player has fired it, so the first argument of OnServerEvent will be the player in that case. So, all you should have to do is remove the Plr
as an argument, and just use the player
variable from above to refer to the LoclPlayer. Also, PlayerGui is with a capital P, and capitalisation matters in Lua. If you are not referring to the PlayerGui through the player, you can use your lowercase p playerGui variable from above.
For example:
local debounce = false local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = Players.LocalPlayer local GuiClicker = ReplicatedStorage:WaitForChild("GuiClicker") local playerGui = player:WaitForChild("PlayerGui") local function OnGuiClickerFired() if debounce == false then playerGui.InfoPanel.ScrollingFrame:TweenPosition(UDim2.new(0.5, -250,0.5, -200, 'Out', 'Bounce', 1)) debounce = true else playerGui.InfoPanel.ScrollingFrame:TweenPosition(UDim2.new(-0.5, -250,0.5, -200, 'Out', 'Bounce', 1)) playerGui.InfoPanel.ScrollingFrame.Visible = true debounce = false end end GuiClicker.OnClientEvent:Connect(OnGuiClickerFired)
You might also want to check if you are setting Visible to true
in the right section.