✓ Accepted answer
Here's something I threw together that seems to work for this. So, the call actually has to be made from a local script, and as long as that local script's function only runs for the specific player that you want then it should work. The way I did this was by having a script in the part that gets touched, a remote event that the script and the local script can access, and a local script. The script detects the hit, and then works out which player it needs to fire the remote event for. The local script waits until it gets fired(which only happens for the specific player's version of the local script) and then toggles the reset thing.
Script code:
local event = game:GetService("ReplicatedStorage").RemoteEvent
local debounce = false
script.Parent.Touched:Connect(function(hit)
if debounce == false then
debounce = true
if hit.Parent:FindFirstChild("Humanoid") then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
event:FireClient(player)
end
end
wait(5)
debounce = false
end)
Local script:
local gui = game:GetService("StarterGui")
local reset = false
function ToggleReset()
if reset == false then
gui:SetCore("ResetButtonCallback", false)
reset = true
else
gui:SetCore("ResetButtonCallback", true)
reset = false
end
end
game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(ToggleReset)
1 comment
Thank you so much it works!