so i have to somehow kill the player before they process to respawning?
some what yes, otherwise you changing character in that while loop
wont detect every time if your health is low.
when changing
- set current character humanoid health to 0
then
- change to the new character.
im sure theres another way but idk.
do you know how to implement that thing, im loosing my path rn
its okay,
the code you have to change - you just set your humanoid.health to 0 then change - if that makes sense
im not sure if this working or not, when i changed my team i dont see any of my health changes. This is the team handler of my game it respawns and spawns plrs when changing their team
it would be easier if you downloaded your game as a file and sent it here. Then i can have a copy of it and try and fix it.
should i send it here or through other media place
heres fine its just a copy of it thats all
zs test.rbxl (1.6 MB)
here, try it out, i already placed the tool in the tool bar, it calls āleapā
which one handles the change team - whats the local script called?
in the server script service there is a script called zombie changer, it handles everything about team changes
the animations arent loading for me so idk, but imma keep looking hol up
the only problem is the humanoid and root part got anchored after respawn basically getting stun locked
Just hammered this out without testing ā¦ Iām sure itās not perfect. More of a dierction if so.
jumpremote.OnServerEvent:Connect(function(plr, hitsmth)
local toolowner = getToolOwnerPlayer(tool)
local char = toolowner.Character or toolowner.CharacterAdded:Wait()
local humanoid = char:FindFirstChildOfClass("Humanoid")
local root = char:FindFirstChild("HumanoidRootPart")
local victim = hitsmth.Parent
local humofvictim = victim:FindFirstChildOfClass("Humanoid")
local rootofvictim = victim:FindFirstChild("HumanoidRootPart")
if not humofvictim or not rootofvictim then return end
local cmaultrack = humanoid:LoadAnimation(cmaulanim)
local vmaultrack = humofvictim:LoadAnimation(vmaulanim)
local function cleanup()
if cmaultrack.IsPlaying then cmaultrack:Stop() end
if vmaultrack.IsPlaying then vmaultrack:Stop() end
root.Anchored = false
rootofvictim.Anchored = false
char:SetAttribute("CanAttack", true)
victim:SetAttribute("CanAttack", true)
humanoid.AutoRotate = true
humofvictim.AutoRotate = true
if pointlight then pointlight:Destroy() end
end
local function onRemove()
cleanup() connection:Disconnect()
end
local victimConnection = victim.AncestryChanged:Connect(function(_, parent)
if not parent then onRemove() end
end)
local ownerConnection = char.AncestryChanged:Connect(function(_, parent)
if not parent then onRemove() end
end)
task.spawn(function()
while humofvictim.Health > 0 and humanoid.Health > 0 do
-- your mauling chunk
task.wait(0.3)
end
cleanup()
end)
connection = connection or victimConnection or ownerConnection
end)
sorry i misclick the solution button but what is ancestry changed
Fires when the hierarchy changes. Used here to help tell if a character is removed.
would try this tomorrow if i have time, or i could ask encrypt logie guy to try it
Iām more pointing out the need for this functionā¦
best to test since i copied this and added the rest and doesnt workā¦ might be me tho
Of course not, I even stated that. Itās a type of detailed pseudocode. I donāt have any of them animations or this set up. No possible way to actually test anything fully. So you get pseudo direction at best. Look at what it is trying to achieve and code it outā¦ Design a reset/cleanup.
Pseudocode is a representation of code used to demonstrate the implementation of an algorithm without actually doing so. It often acts as a rough draft of coding projects, and is written in an explainable manner to be understandable.