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

Help needing to know what players local script fired a event?

Asked by 2 years ago
Edited 2 years ago

Okay so basically. I have a part where if you touch it. It changes text on a gui and it says secure. but whenever 1 player does it. it changes the text for everyone. I dont want it to change the text for everyone. Just for the player that touched the part.


ServerScript

secureEvent.OnServerEvent:Connect(function(player)
    print(player.Name)
    player.Character.StatusValue.Value = "Secure"

    player.PlayerGui.Status.StatusFrame.StatusState.Text = "Secure"
    player.PlayerGui.Status.StatusFrame.StatusState.TextColor3 = Color3.new(0.180392, 1, 0)
    print(player.Name.." is secure")

end)

LocalScript

local hostile = game.Workspace.HostileTerritory
local secure = game.Workspace.Secure

local hostileEvent = game.ReplicatedStorage.Events.PlayerStatus.HostileEvent
local secureEvent = game.ReplicatedStorage.Events.PlayerStatus.SecureEvent

secure.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then

        secureEvent:FireServer()
        print("the event was fired")
    end
end)
0
As I see It really shouldn't show up for anyone else really. VitroxVox 884 — 2y

Answer this question