[SOLVED] "GetPropertyChangedSignal" not functioning, any idea why?
Asked by
5 years ago Edited 3 years ago
Explanation: So I'm trying to make a script for a hospital roleplay game. When the player enters the game, the game auto-detects whether they are in a group or not and whether they have enough rank. If the player has enough rank and is in the group, the player will automatically be on the team "Hospital Staff", otherwise, the player will automatically be on team "Patient". There's 2 teams, 1 is called "Hospital Staff". Another team is called "Patient". My problem here is that when a player changed the team, the game won't detect, i've tried to use GetPropertyChangedSignal
function but it does not detect as well..
I Have 3 scripts.
First Script: Located In StarterPack Named "TeamChooseLocal". It's a local script as u can tell from the name. This is the script for detecting whether they are in the group and have enough rank.
Second Script: Located In a part named "ReceptionDoor" in Workspace, Named "ReceptionDoorAccessServer". It's a server script (as you can tell). This is the script where it detects which team a player is in and whether to give access to the reception door to a player.
Third Script: Located in StarterPack Named "ReceptionDoorAccessLocal". Well, you know what type of script is that. This is the script where is it gets the rank from the group to see if player meet the requirement when they select "Hospital Staff" Rank and check if they are in the group as well so that they will have access to the reception door if they did.
Here are the scripts.
TeamChooseLocal:
01 | local Player = game.Players.LocalPlayer |
02 | local Teams = game:GetService( "Teams" ) |
03 | local ReceptionDoorEvent = game:GetService( "ReplicatedStorage" ):WaitForChild( "EventsFolder" ):WaitForChild( "ReceptionDoorAccessEvent" ) |
06 | if Player:IsInGroup( 5786709 ) and Player:GetRankInGroup( 5786709 ) > 1 then |
07 | print ( "Player Is In Group: Robloxia City Hospital" ) |
08 | print ( "Player's Rank Is: " ..Player:GetRankInGroup( 5786709 )) |
09 | Player.Team = Teams [ "Hospital Staff" ] |
10 | print ( "Team Changed, Player's Team Is Hospital Staff" ) |
11 | ReceptionDoorEvent:FireServer() |
13 | elseif Player:IsInGroup( 5786709 ) and Player:GetRankInGroup( 5786709 ) = = 1 then |
14 | print ( "Player Is In Group: Robloxia City Hospital" ) |
15 | print ( "Player's Rank Is: " ..Player:GetRankInGroup( 5786709 )) |
16 | Player.Team = Teams.Patient |
17 | print ( "Team Changed, Player's Team Is 'Patient'" ) |
18 | ReceptionDoorEvent:FireServer() |
21 | print ( "Player Is Not In Group: Robloxia City Hospital!" ) |
22 | Player.Team = Teams.Patient |
23 | print ( "Team Changed, Player's Team Is 'Patient'" ) |
24 | ReceptionDoorEvent:FireServer() |
ReceptionDoorAccessServer:
01 | local ReceptionDoorEvent = game:GetService( "ReplicatedStorage" ):WaitForChild( "EventsFolder" ):WaitForChild( "ReceptionDoorAccessEvent" ) |
02 | local ReceptionDoorEvent 2 = game:GetService( "ReplicatedStorage" ):WaitForChild( "EventsFolder" ):WaitForChild( "ReceptionDoorAccessEvent2" ) |
04 | local Teams = game:GetService( "Teams" ) |
06 | game.Players.PlayerAdded:Connect( function () |
07 | script.Parent.Touched:Connect( function (ReceptionDoor) |
08 | if ReceptionDoor.Parent:FindFirstChild( "HumanoidRootPart" ) then |
09 | if Touched = = false then |
11 | print ( "HumanoidRootPart Found" ) |
12 | ReceptionDoorEvent.OnServerEvent:Connect( function (Player) |
13 | print ( "ReceptionDoorEvent Received Signal" ) |
14 | if Player.Team = = Teams [ "Hospital Staff" ] then |
15 | print ( "Player Is In Team: Hospital Staff, Access Granted!" ) |
16 | ReceptionDoorEvent 2 :FireClient(Player) |
18 | elseif Player.Team = = Teams.Patient then |
19 | print ( "Player Is In Team: Patient, Access Not Granted!" ) |
24 | elseif ReceptionDoor.Parent:FindFirstChild( "Torso" ) then |
25 | if Touched = = false then |
28 | ReceptionDoorEvent.OnServerEvent:Connect( function (Player) |
29 | print ( "ReceptionDoorEvent Received Signal" ) |
30 | if Player.Team = = Teams [ "Hospital Staff" ] then |
31 | print ( "Player Is In Team: Hospital Staff, Access Granted!" ) |
32 | ReceptionDoorEvent 2 :FireClient(Player) |
34 | elseif Player.Team = = Teams.Patient then |
35 | print ( "Player Is In Team: Patient, Access Not Granted!" ) |
41 | ReceptionDoorEvent 2. OnServerEvent:Connect( function () |
ReceptionDoorAccessLocal:
01 | local ReceptionDoorEvent 2 = game:GetService( "ReplicatedStorage" ):WaitForChild( "EventsFolder" ):WaitForChild( "ReceptionDoorAccessEvent2" ) |
02 | local LocalPlayer = game.Players.LocalPlayer |
03 | local ActualReceptionDoor = game.Workspace:WaitForChild( "ReceptionDoor" ) |
04 | local Teams = game:GetService( "Teams" ) |
06 | ReceptionDoorEvent 2. OnClientEvent:Connect( function () |
07 | print ( "ReceptionDoorEvent2 Received Signal" ) |
08 | if LocalPlayer:GetRankInGroup( 5786709 ) > = 3 then |
09 | print (LocalPlayer:GetRankInGroup( 5786709 )) |
10 | ActualReceptionDoor.Transparency = 0.5 |
11 | ActualReceptionDoor.CanCollide = false |
13 | ActualReceptionDoor.Transparency = 0 |
14 | ActualReceptionDoor.CanCollide = true |
15 | ReceptionDoorEvent 2 :FireServer() |