the problem is that I have no argument attributed. Here is the script:
Server:
plugin:Activate(false)
local mouse = plugin:GetMouse()
function Button1Up()
game:GetService('PluginGuiService'):FindFirstChild('Sign').Sign.Mouse1Up:FireClient() -- error there
end
mouse.Button1Up:Connect(Button1Up)
Client:
script.Parent.Parent.Parent.Parent.Parent.Parent.Mouse1Up.OnClientEvent:Connect(function()
if clicked == true then
trigger()
clicked = false
TweenService:Create(script.Parent, TweenInfo.new(0.15), {Position = UDim2.new(script.Parent.Position.X.Scale, 0, 0.076, 0)}):Play()
end
if debounce == false then
TweenService:Create(script.Parent, TweenInfo.new(0.15), {BackgroundColor3 = colorLibrary['MouseLeave']}):Play()
end
clicked = false
end)
You need to pass the player argument in FireClient. Assuming this will run during simulation you can get the studio player instance using the following method:
--this method only works for plugins and the command line
local StudioService = game:GetService("StudioService")
local StudioUserId = StudioService:GetUserId() --returns the studio user id if you are logged in
--this should run during simulation else the player object doesn't exist(idk if it exists in TeamCreate sessions tho)
local Player = game.Players:GetPlayerByUserId(StudioUserId)
print(Player.Name)
--basically pass Player to your FireClient thing
That error means you try to run FireClient in a LocalScript, instead it should be a Script(since the server is trying to contact the client). From a client script you can contact the server however through FireServer(args).
It seems like you are encountering an error when trying to fire a client event from the server. The error message you provided indicates that there is an issue with passing arguments to the FireClient method. Looking at your code, I noticed that you are not providing any arguments when calling FireClient().
In order to resolve this issue, you need to pass the necessary arguments to the FireClient method. The FireClient method expects at least one argument, which is the player you want to send the event to. Here’s an updated version of your code that includes the necessary argument:
Server:
plugin:Activate(false)
local mouse = plugin:GetMouse()
function Button1Up()
local player = -- get the player you want to send the event to
game:GetService('PluginGuiService'):FindFirstChild('Sign').Sign.Mouse1Up:FireClient(player) -- pass the player as an argument
end
mouse.Button1Up:Connect(Button1Up)
Client:
script.Parent.Parent.Parent.Parent.Parent.Parent.Mouse1Up.OnClientEvent:Connect(function()
if clicked == true then
trigger()
clicked = false
TweenService:Create(script.Parent, TweenInfo.new(0.15), {Position = UDim2.new(script.Parent.Position.X.Scale, 0, 0.076, 0)}):Play()
end
if debounce == false then
TweenService:Create(script.Parent, TweenInfo.new(0.15), {BackgroundColor3 = colorLibrary['MouseLeave']}):Play()
end
clicked = false
end)
Remember to replace -- get the player you want to send the event to with the appropriate code to retrieve the player you want to target with the event.