I wanted to make someone bigger once an event fires, but you can’t edit proportions on the client and you can’t get the player who triggered the function on server (players.localplayer), i need to get the local player name in the client script and then fire the function on the server script, is it possible?
When you send a RemoteEvent from Client to Serverthe player instance of the client is automatically sent to the server as the first argument (followed by any other arguments you want to send).
See:
https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events#client-to-server
Could you explain it further please? I really don’t understand what’s happening in the script. If I add an event and fire it on the client script with a (player) arg will it automatically set the argument to the player?
You don’t need to send the player argument because the Remote will do that for you. This is used to differentiate client calls on the server, because multiple clients could be calling the same remote, but you want to only do some action for that one player.
By design, a RemoteEvent from client to server will pass the player argument as the first argument. However, as this is essence just a variable, it can take any variable name that you set to it (and you could choose to ignore it if you were to not accept any arguments).
It seems I’ve fixed it
game.ReplicatedStorage.Remotes.Functions.kickbanned.OnClientEvent:Connect(function(player)
local func = game.ReplicatedStorage.Remotes.Functions.func
func:FireClient(player)
local a = game.ReplicatedStorage.Effects.shift:Clone()
a.Parent = game.Players.LocalPlayer.Character
a.sfx:Play()
a.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
local cc = a.cc:Clone()
cc.Parent = game.Lighting
wait(2)
cc:Destroy()
end)
EDIT: I used a remote event instead of a function, mb
If you don’t plan on returning a value through that event, then you should stick to using a RemoteEvent, not a RemoteFunction. In that code snippet you are using an event, not a function - which should work fine.
You’re also either firing to the client through a client script, or using a client listener on a server script. I don’t fully understand your intentions behind this but you will likely run into some other issues down the line based on what I’m seeing.
you can’t fire a client from the client
Thank you so much, you have no idea how much time I’ve spent trying to figure that out. It worked in the end. I invoked the function on client and got the player from it on the server.