so like its rewarding all clients and i dont want that how do i fix this???
local rep = game.ReplicatedStorage
local remote = rep:WaitForChild("ChangeValue")
debounce = true
while true do
wait(1)
local plr = game:GetService("Players").LocalPlayer
local Gui = plr.PlayerGui.Quest:WaitForChild("DOIT")
local Gui1 = plr.PlayerGui.Quest:WaitForChild("Framo")
local Humanoid = game.Workspace.ThiefBoss:FindFirstChild("Enemy")
Humanoid.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if Humanoid ~= nil and debounce == true then
debounce = false
game.Players:GetPlayerFromCharacter(hit.Parent)
Humanoid.Died:Connect(function()
if hit.Parent then
Gui:TweenSize(UDim2.new(0,227,0,152), Enum.EasingDirection.In, Enum.EasingStyle.Elastic,1,true,nil)
wait(1)
Gui.Visible = false
if Gui.Visible == false then
Gui1.TextLabel.Text = "Thank you for defeating the Thief Boss"
remote:FireServer("Quest")
wait()
debounce = true
end
end
end)
end
end)
end

4 comments
Its still changing for every client
You need to put it in a serverscript
You can't put this in a server script, it references LocalPlayer, PlayerGui of the LocalPlayer, a single variable for lastTouch (cannot track multiple players),etc. This is still all client-only code.
First of all theres only one enemy who he’s trying to get the lasttouch of hence why its a single variable, secondly i didnt include any of the gui stuff in my answer for that reason, he’ll need to communicate with the client himself