You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
i want to make basically a downed animation, think of last stand perk in call of duty
What is the issue? Include screenshots / videos if possible!
i cant get the animation to play also i dont know if it will look right i want to have the char laying down which is the last frame of the animation until either the time is up or they get revived
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
tried using a local script and server script, set the animation to action and tried the loop option maybe there is a simpler way to do this
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local deathspot
game:GetService('Players').PlayerAdded:Connect(function(player)--player is added
player.CharacterAdded:Connect(function(character)--player.character is added
character:WaitForChild("Humanoid").Died:Connect(function()--death
deathspot = character.PrimaryPart.Position
local plrdwn = player.leaderstats.Downed
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://7257093097"
if plrdwn.Value == false then
plrdwn.Value = true
wait(.5)
player.Character.PrimaryPart.Position = deathspot
player.Character.PrimaryPart.Anchored = true
anim:Play()
wait(15)
player.Character.PrimaryPart.Anchored = false
elseif plrdwn.Value == true then
plrdwn.Value = false
print(player.Name.." has died!")
print(player.Name.." has died!")
print(player.Name.." has died!")
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value/2
player.Character.PrimaryPart.Anchored = false
end
end)
end)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
You are still not playing or creating an animationtrack, the code doesn’t show :Play(), and also if you’re playing an animation on to a player you should play it locally.
local Player = game.Players.LocalPlayer
local Deathspot
Player.CharacterAdded:Connect(function(Char)
local Humanoid = Char:WaitForChild("Humanoid")
local Animator = Char:WaitForChild("Animator")
Humanoid.Died:Connect(function()
Deathspot = Char.PrimaryPart.Position
local PlrDown = Player.leaderstats.Downed
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://7257093097"
local AnimationTrack = Animator:LoadAnimation(Animation)
if PlrDown.Value then
PlrDown.Value = false
print(Player.Name.." has died!")
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value/2
Char.PrimaryPart.Anchored = false
elseif not PlrDown.Value then
PlrDown.Value = true
task.wait(0.5)
Char.PrimaryPart.Position = Deathspot
Char.PrimaryPart.Anchored = true
AnimationTrack:Play()
task.wait(15)
Char.PrimaryPart.Anchored = false
end
end)
end)
Try this in StarterPlayerScripts, the only issue you will have, is the respawn time of the character - respawn time being much higher, as the game will automatically reload the Humanoid, so you would need to either increase the respawn time or create a clone of the character.
Technically, anchoring on the client will work because for all intensive purposes the server sees the player as the network owner (as far as I know).
But you can use a remote event to handle that if you’d prefer - I would suggest increasing your respawn time to 15 or creating a clone of the character on the server, make sure to untick Archivable.
im trying to do the character clone option how do i play it from the clone
local deathspot
local rs = game.ReplicatedStorage
local deathevent = rs.downeddeath
local downedevent = rs.Downed
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
deathspot = character.PrimaryPart.Position
local plrdwn = player.leaderstats.Downed
local humanoid = character:WaitForChild("Humanoid")
if plrdwn.Value == false then
plrdwn.Value = true
character.Archivable = true
local downedplr = character:Clone()
character.Archivable = false
downedevent:FireClient(player,downedplr)
local newcharhumanoid = downedplr:WaitForChild("Humanoid")
downedplr.PrimaryPart.Position = deathspot
downedplr.Parent = workspace
downedplr.HumanoidRootPart:SetNetworkOwner(player)
newcharhumanoid.Died:Connect(function()
downedplr:Remove()
deathevent:FireClient(player,downedplr)
plrdwn.Value = false
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value/2
end)
end
end)
end)
end)
local
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local WeaponsSystem = ReplicatedStorage:WaitForChild("WeaponsSystem")
local weaponModule = require(WeaponsSystem:WaitForChild("WeaponsSystem"))
local camera = workspace.Camera
local plr = game.Players.LocalPlayer
plr.CameraMaxZoomDistance = 50
weaponModule.camera:setEnabled(false)
weaponModule.camera.rotateCharacterWithCamera = false
camera.CameraSubject = script.Parent
weaponModule.normalOffset = Vector3.new(0,0,0)
local rs = game.ReplicatedStorage
local deathevent = rs.downeddeath
local downedevent = rs.Downed
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
----------------------------------------------------------------------------------------------------------
---------------------------DownedPlayerCameraScript--
local function playerdowned(downedplr)
local Animator = downedplr:WaitForChild("Animator")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://7257093097"
local AnimationTrack = Animator:LoadAnimation(Animation)
AnimationTrack:Play()
end
local function plrdeath(downedplayer)
camera.CameraType = "Custom";
camera.CameraSubject = plr.Character.Humanoid
end
plr.Character:WaitForChild("Humanoid").Died:Connect(function()
local plrdown = plr.leaderstats.Downed
if plrdown.Value == false then
camera.CameraType = "Fixed";
end
end)
deathevent.OnClientEvent:Connect(plrdeath)
downedevent.OnClientEvent:Connect(playerdowned)