So I tried to use LoadCharacter() and apparently that doesn't work on local scripts, and using LocalPlayer doesn't work on scripts and I'm getting really confused now and I can't find and good answers on the internet. Can someone please expalin it?
Can somebody explain the full difference between Script and Local Script?
2 answers
Hi TMGOR,
There are some methods that are only designed for local scripts just because of security or the way that studio works. LocalScripts are basically scripts that clone to the client... so, the client would be my computer and the local script would be on my side. Then, just 'Script' is called a ServerScript, which means that these scripts stay on the Server. LocalPlayer can only be accessed by LocalScripts because they are the ones on the client and LocalPlayer is the client's player. That's the basic difference between Local and Server scripts... Just remember that some methods can only be used on client side and some can only be used on the server side. If you think this is complicated then good luck with FilteringEnabled.
##Well, hope I helped and have a nice day/night.
Thanks,
Best regards,
~~ KingLoneCat
3 comments
That's literally what I just summarized. Sheesh.
I was writing mine out while you were writing yours out. I hadn't seen yours until I posted mine.
Methods being usable only by LocalScripts for "security purposes" makes no sense; a hacker can inject whatever LocalScript they want, which could make use of these functions. The reason some features are client-only is because it doesn't make any sense for the server. If a method was to be secure, it would be accessible from the server only, not the client.
Here's the juice you should know:
Regular Scripts are server wide and using methods like GetPlayerFromCharacter (which, by the way, you can only call from game.Players) will work because every player can apply to that method. Using Scripts enables every player to see something and not just one player (like the for loop used for the PlayerGui).
Local Scripts only run on one player's computer and cannot be seen by other computers within a server. Directories such as "game.Players.LocalPlayer" are only compatible with LocalScripts and will NOT work with regular Scripts.
This is how you would use GetPlayerFromCharacter() by the way:
-- Regular Script
local part = script.Parent
bool = true
part.Touched:Connect(function()
bool = false
local p = game.Players:GetPlayerFromCharacter(part)
if p then
print(p.Name.." has touched me!")
end
wait()
bool = true
end)
2 comments
if bool == true then --> why would you need a debounce if you don't do that lol
Player.LocalPlayer is not a "directory", it is a property -- and is part of individual player objects, not the Players service -- please learn the proper vocabulary if you wish to answer questions properly. "Regular Scripts are server wide and using methods like GetPlayerFromCharacter [...] will work because every player can apply to that method", that also doesn't make any sense.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
script: for the server local script: client