So if I killed someone in my game they die on my screen but does not respawn. But on their screen, they see them alive and if they touch me I die and I do not respawn. Please help, thank you.
Are you killing players in a LocalScript? If so, it makes sense that only you can see it.
ROBLOX uses a Client-Server Model, which means your client can't affect other players. This means that, rather than your computer telling the server "this player is now dead", you need to ask the server "please make this player dead" and then the server will tell everyone "this player is now dead".
However, this is a bad example. The server should not allow the client to automatically kill people arbitrarily. The server should be the one deciding when someone should or shouldn't be killed. In that case, say we have a sword. This sword is supposed to damage people.
In the sword, there is a LocalScript, a Script, and a RemoteEvent. This RemoteEvent will be the 'Hit event'. A RemoteEvent allows a LocalScript to tell a Script on the server that something happened.
In the LocalScript, there will be something like this:
script.Parent.Equipped:Connect(function(mouse) local connection = script.Parent.Activated:Connect(function() local target = mouse.Target if not target then return end local foundHumanoid = target.Parent and target.Parent:IsA('Model') and target.Parent :FindFirstChildWhichIsA('Humanoid') if not foundHumanoid then return end script.Parent.Hit:FireServer(foundHumanoid) end) script.Parent.Unequipped:Wait() connection:Disconnect() end)
In the Script, there will be something like this (if statement split out into multiple lines for readability purposes):
local debounces = {} local function isInstance(instance) return instance and type(instance) == 'userdata' and getmetatable(instance) and instance.ClassName ~= nil end script.Parent.Hit.OnServerEvent:Connect(function(player, humanoid) if not debounces[player] and isInstance(humanoid) and humanoid:IsA('Humanoid') and humanoid.Parent and humanoid.Parent:IsA('Model') and humanoid.Parent.PrimaryPart and player.Character and player.Character.PrimaryPart and player.Character.PrimaryPart.CFrame :ToObjectSpace(humanoid.Parent.PrimaryPart.CFrame) .Position.Magnitude < 3 then debounces[player] = true humanoid:TakeDamage(15) wait(1) debounces[player] = false end end)
Basically, when you hit a player, the LocalScript is telling the server a player was hit. It's that simple.
Then, the script does all the work. It's very important to make sure the client isn't lying, since you can't trust them EVER. The script makes sure that the player's character exists, the enemy's character/humanoid exists, they are close enough to be hit by the sword, and only allows the player to hurt someone else once per second. This is an incredibly safe way to code. Never believe the client. Always implement server logic on the server.
Anyway, hope I helped. Make sure you fire the event when you swipe the sword, or whatever weapon you have (and make sure you know the Humanoid you're trying to damage), and you should be fine.
Comment if you need any extra help, I can edit my answer, but if I helped remember to upvote and accept~