|
| 26 Jan 2017 06:09 PM |
Hey, so here's my script:
local hold = false script.Parent.Touched:connect(function(hit) if not hold then hold = true game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageGui.Enabled = true wait(1) game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageGui.Enabled = false hold = false end end
This works in Studio, but not online. What should I do to fix this? |
|
|
| Report Abuse |
|
|
OAuth2
|
  |
| Joined: 27 Nov 2016 |
| Total Posts: 751 |
|
|
| 26 Jan 2017 06:11 PM |
Jeez.
The reason why it works in studio because play testing basically "plays/converts" the game locally, meaning you can access the local player anywhere.
You need to define the player when you want to access it on a real server. |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 06:12 PM |
@Auth Okay, but how would I still get it to affect all players? I don't want to type every single ROBLOX username in, after all. |
|
|
| Report Abuse |
|
|
OAuth2
|
  |
| Joined: 27 Nov 2016 |
| Total Posts: 751 |
|
|
| 26 Jan 2017 06:14 PM |
You don't need to.
script.Parent.Touched:connect(function(Hit) if game.Players:GetPlayerFromCharacter(Hit) then local Player = game.Players:GetPlayerFromCharacter(Hit) -- do stuff end end) |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 06:17 PM |
| Ah, gotcha. Okay, I'll try that. Thanks. |
|
|
| Report Abuse |
|
|