|
| 27 Dec 2016 02:55 PM |
I'd like to make a script that when the player with the right team would clic the Surface GUI button it would open up a menu on that surface gui. for some reason LocalScript dosen't work in the Public Servers only in Test
so
if game.Players.LocalPlayer.Team == game.Teams["Team"] then
dosen't work
nor does
if game.PLayers.LocalPlayer.TeamColor == BrickColor.new("TeamColor") then
any help? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 27 Dec 2016 02:59 PM |
Even I have no idea what you mean by adornee.
All I can say is add some prints to see how far your script is getting. This will allow you to determine the problem lines. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Dec 2016 03:04 PM |
I just googled adornee Roblox I know what it means...
It's adorne'd to an invisible Part called "DJ" in the workspace. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Dec 2016 03:32 PM |
| So the SurfaceGui is in the PlayerGui and you're using a LocalScript? |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 03:33 PM |
| Ok I just noticed I didn't have to ask this question... |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Dec 2016 03:44 PM |
| "All I can say is add some prints to see how far your script is getting. This will allow you to determine the problem lines." [2] |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 03:47 PM |
| but I can't see print in public server... and in test servers everything's fine |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 03:59 PM |
| I think if you press on F5 or F9 you get an output while in public servers. If you're the owner, you can access both server and local output, while others only access the local one. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 04:01 PM |
| actually I just checked it out , there's nothing that shows up but the "localPlayer" just dosen't work how do I manage to bypass that to restrict the button to a team only? |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 04:05 PM |
| Can you show us the whole script. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 04:08 PM |
if game.Players.LocalPlayer.Team == game.Teams[Team] then
You put Team in quotations, meaning its a string, which it isn't. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 04:12 PM |
local Music = script.Parent.Sound local Play = script.Parent.Parent.Parent.Playing
function onClick() if game.Players.LocalPlayer.Team == game.Teams["Disc Jokey"] then end if Music.Playing == true then Music.Playing = false Play.Text = ("Nothing's Playing.") elseif Music.Playing == false and Play.Text == ("Nothing's Playing.") then Play.Text = ("Currently Playing.") Music.TimePosition = 0 Music.Playing = true wait(186) Play.Text = ("Nothing's Playing.") end end
script.Parent.MouseButton1Click:connect(onClick)
This is my whole script. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 05:16 PM |
| regular script or local script?? |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 27 Dec 2016 07:19 PM |
try this
local Player = game.Players.LocalPlayer local Gui = script.Parent local Music = Gui:WaitForChild('Sound') local Play = Gui.Parent.Parent.Playing
Gui.MouseButton1Click:connect(function() if Player.Team == game.Teams['Disc Jokey'] then if Music.Playing then Music.Playing = false Play.Text = 'Nothing is Playing' elseif not Music.Playing and Play.Text == 'Nothing is Playing' then Play.Text = 'Currently Playing' Music.TimePosition = 0 Music.Playing = true wait(186) Play.Text = 'Nothing is Playing' end end end)
|
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 08:15 PM |
| This is the error it gave me attempt to index upvalue 'Player' (a nil value) |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Dec 2016 09:12 PM |
| ~Bump again~ @TimeTicks Help plz? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 28 Dec 2016 02:41 PM |
Wait for the Player to load. I think the script loads before the player.
repeat wait() until game.Players.LocalPlayer
Just add this to the beginning of the script. |
|
|
| Report Abuse |
|
|