Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my GUI only displaying for the client and not the server?

Asked by 5 years ago
Edited 5 years ago

Basically, the code will display a players' rank insignia based on their group rank, however for some reason the images are only being shown to the client. Other players are unable to see the insignia, so I can only assume this is an issue regarding FilteringEnabled. How would I fix this?

player = game.Players.LocalPlayer
if player:GetRankInGroup(3798852) == 255 then -- Chief Constable
script.Parent.Image = "http://www.roblox.com/asset/?id=1312036764"
elseif player:GetRankInGroup(3798852) == 250 then -- Deputy Chief Constable
script.Parent.Image = "http://www.roblox.com/asset/?id=1312053272"
elseif player:GetRankInGroup(3798852) == 245 then -- Assistant Chief Constable
script.Parent.Image = "http://www.roblox.com/asset/?id=1312053632"
elseif player:GetRankInGroup(3798852) == 240 then -- Chief Superintendent
script.Parent.Image = "http://www.roblox.com/asset/?id=1312053733"
elseif player:GetRankInGroup(3798852) == 235 then -- Superintendent
script.Parent.Image = "http://www.roblox.com/asset/?id=1312053836"
elseif player:GetRankInGroup(3798852) == 230 then -- Chief Inspector
script.Parent.Image = "http://www.roblox.com/asset/?id=1312053930"
elseif player:GetRankInGroup(3798852) == 20 then -- Inspector
script.Parent.Image = "http://www.roblox.com/asset/?id=1312054043"
elseif player:GetRankInGroup(3798852) == 15 then -- Sergeant
script.Parent.Image = "http://www.roblox.com/asset/?id=1312054113"
end
2
The server is not supposed to be touching GUIs like that. Also please use local variables, player is global but doesn't need to be, also don't repeatedly call a function, you only need to call :GetRankInGroup once, and please don't abuse if - elseif statements like that. User#24403 69 — 5y
0
Sorry, I feel as though I didn't explain very well. This is a LocalScript which displays a rank insignia. It's attached to a vest on the player. My issue is that only the player wearing the vest can see his rank insignia, and it is blank for everybody else. I also apologise for my lack of efficiency, it's an old(er) piece of code which I'm just trying to fix at the moment. Thanks. BritishActuaI 44 — 5y
0
In addition, how would you recommend making that more efficient? I didn't see any other ways of having different images attached to different ranks other than to repeat elseif statements. BritishActuaI 44 — 5y

Answer this question