generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: how do you use localplayer serverside

Previous Thread :: Next Thread 
64kingJOE is not online. 64kingJOE
Joined: 16 Jan 2016
Total Posts: 7078
25 Dec 2015 08:04 AM
what's the alternative?

http://www.roblox.com/Wind-of-Fjords-item?id=277801972
Report Abuse
gskw is not online. gskw
Joined: 05 Jan 2013
Total Posts: 1364
25 Dec 2015 08:20 AM
That's illogical. There's not one player on the server you can choose from. If you want to apply code to all players, use:

```
local function PlayerHandler(Player)
-- Goes here!
end

game.Players.PlayerAdded:connect(PlayerHandler);
for _, Player in next, game.Players:GetPlayers() do
PlayerHandler(Player);
end
```
Report Abuse
64kingJOE is not online. 64kingJOE
Joined: 16 Jan 2016
Total Posts: 7078
25 Dec 2015 08:48 AM
plr = game.Players.LocalPlayer
tool = game.ServerStorage["Knife"]

script.Parent.MouseButton1Down:connect(function()
if plr.Backpack:FindFirstChild("Knife") == nil then
tool:clone().Parent = plr.Backpack
else return end
end)

How do I get this to work serverside?

http://www.roblox.com/Wind-of-Fjords-item?id=277801972
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
25 Dec 2015 09:31 AM
1. Learn to write clean code.
2. Use a Remote Event.

Script0 has become unstable.. Please terminate it.
Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
25 Dec 2015 09:35 AM
To use something like that on the server you would need to either:

A) Know the name of the player you're trying to reference
B) Know the player who clicked on it

This can only be done on the server if you're using a ClickDetector or some really really awesome remote events. If you're talking about a SurfaceGui you would need to put the SurfaceGui inside of StarterGui; there's no way a text button can get the player clicking it solely from the server.
Report Abuse
gskw is not online. gskw
Joined: 05 Jan 2013
Total Posts: 1364
25 Dec 2015 11:25 AM
You can't use MouseButton1Down serverside. You'll have to keep the LocalScript but change it to fire a RemoteEvent serverside, which should then give the tool (which still wouldn't make sense. You should move the knife to ReplicatedStorage and give it locally.)
Report Abuse
64kingJOE is not online. 64kingJOE
Joined: 16 Jan 2016
Total Posts: 7078
25 Dec 2015 12:01 PM
Eh?

http://www.roblox.com/Wind-of-Fjords-item?id=277801972
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
25 Dec 2015 01:17 PM
@gskw

Without FE (haven't tested with FE), it does work. But the effects are highly undesirable, because you can't do much.

Script0 has become unstable.. Please terminate it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image