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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|