Is it possible to find the local players character without being in a local script?

Let me elaborate, I am learning how to script, so I decided to start to make a workout game, where every time you click you grow. However, Since it is done in a local script, no one else in the game can see it. Only the player controlling this local player.

PS: I am not asking for a full fledged script, I am only asking if this task is possible, and how I would do it.

Bonus: if theres a youtube video or website I can learn from that would be excellent.

Current script: Local script (script does work)

RemoteEvent. LocalScripts can fire this remote and the server will receive the player as the first parameter to any function connected to OnServerEvent. It’s not necessarily finding the LocalPlayer but rather determining which client requested an action to be performed by the server and the server knowing which client made the request. Server can then replicate growth effect(s).

3 Likes

technically Backpack is a descendant of the player

Interesting, I will search this up and hopefully it will work

use remote events

1 Like

I did everything it said to do in the website, but it turned out the same.
Example picture

Script:
local script with remote event

Same result as last time…

example photo

they still only rise up and not grow.

You ALSO need a server script on the other side telling what the remote event to do

1 Like

Use remoteEvents. With RemoteEvents you can send information or, you could execute a action for all clients to replicate while targetting a player.
Example:

Localscript:

RE.OnClientEvent:Connect(function(player, message)
print(message) --Second parameter sent through remoteEvent
print(player) --Player is the player who sent the remoteEvent. this way you can ONLY do stuff with the player while replicating it to other clients.
end)

RE:FireServer("I want to grow!") --Fire RemoteEvent

–ServerScript

local RE = Instance.new("RemoteEvent", storage)
RE.Name = "grow"

RE.OnServerEvent:Connect(function(plr, msg) --When the serverscript receives the fired event
       RE:FireAllClients(plr, msg) --Fires a remoteEvent to ALL clients together with the parameters
end)

This way you can find the specific player’s character, and execute whatever you want to do on the player character.

1 Like