I have made a little system, whenever a player hits a certain zone (part) the overhead GUI I made will show up with a tag, overall that part works. But I am having issues
The system is based on a remote event, the script inside the part is the following:
player = game.Players.LocalPlayer
script.Parent.Touched:connect(function()
game:GetService("ReplicatedStorage").KOS:FireServer(player)
end)
This will fire the event with is located in the RepliactedStorage. inside ServerScriptService
game.ReplicatedStorage.KOS.OnServerEvent:connect(function(Player)
if Player.Character.Rank.VIP.Visible == false then -- VIP won't be able to be KoS
Player.Character.Rank.KOS.Visible = true -- None VIP's are able to be KoSed
end
end)
Now there comes the issue the Tag works and all but when it does change the tag it does it for everyone in the server, not just the person who triggered it. How could I make ti so it only changes it for the player who triggered it and not the whole server?
I tried messing around with Player but did not find a way to really fix it as I am a starter into sctripting.
--Server script
script.Parent.Touched:connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
if Player.Character then
if Player.Character.Rank.VIP.Visible == false then -- VIP won't be able to be KoS
Player.Character.Rank.KOS.Visible = true -- None VIP's are able to be KoSed
end
else
Player.CharacterAdded:Wait()
end
end
end)
Works, also to make it so its a certain group rank it would be something like this?
--Server script
local GroupID = 7840509
script.Parent.Touched:connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
if Player.Character then
if Player:GetRankInGroup(GroupID) <= 12 then -- VIP won't be able to be KoS
Player.Character.Rank.KOS.Visible = false -- None VIP's are able to be KoSed
end
else
Player.Character.Rank.KOS.Visible = true
Player.CharacterAdded:Wait()
end
end
end)