I’m a solo developer, I have no one to work with currently. So no, I’m not using Team Create.
You might without realizing it, but if you’re sure then ok.
I just checked, it’s not on.
That happens when you 're using team create and didn’t commit your scripts.
Edit: if your sure it’s off then that’s very weird.
I just tried that in Studio and did not work for me. I have no idea why this happens, but a hacky solution would be to add a delay of, let’s say, 1 second, before :MoveTo()
in the scripts provided by @C_Sharper and @C0lvy123.
I tried using a more “professional” method, such as :WaitForChild(“HumanoidRootPart”) but it did not work either. I am totally unaware of anything (some annoying core script? hidden code in animation scripts?? setting a model’s primary part takes ages to complete???) that seems to be avoiding the character to be moved immediatly or shortly after respawning…
This happens with both MoveTo() and SetPrimaryPartCFrame()
Possibly runs too quickly. Either that or the character hasn’t actually loaded in the game despite the event running; which I’ve had countless problems with that prior.
Updated code to try:
game.Players.PlayerAdded:Connect(function(player)
local spawn_point
player.CharacterAdded:Connect(function(char)
wait(1)
if spawn_point then
char:MoveTo(spawn_point)
end
char:WaitForChild("Humanoid").Died:Connect(function()
spawn_point = char.HumanoidRootPart.Position
end)
end)
end)
If you could open a PM with me I could try and help you with your issue, and maybe give you some tips on how to learn Lua
Still did not work. weird…
That’s bizarre. I’m going to test this out in my own game and see if I can’t debug it for you.
You need to provide more info, other than “Still won’t work” (Trust me).
Have you tried print statements? Where is the script located? What type of script? Is it even running? What does the output say? Any misspelled words?
If you need help, provide as much information as possible
I don’t know what “print statements” is yet since I’m new to scripting. I took many scripts that people gave me to help me (thanks guys). The script is just a normal “Script”. I’m not sure if it’s running… I’m not an expert scripter sooo… I don’t know.
All I want is a script that allows my character to spawn EXACTLY where I died.
For example:
(spawn) (this is where I died) Then, I respawn where I died.
vvv--------------------------------vvv
I tested the code I gave you in my recent post, and I’ve had no issues with it running for me.
Where are you putting the script in your game? Is it a LocalScript? If it’s a LocalScript, it needs to be a regular Script as we want this to run server-sided.
It’s a normal script in ServerScriptService.
Can you send the place in here, or to me via a private message?
If you’re available tomorrow I’ll give you the game link. Goodnight! (If it’s night-time for you)
Players = game:GetService("Players")
Player = Players.LocalPlayer
repeat wait() until
Char = Player.Character
Hum = Char:WaitForChild("Humanoid")
HRP = Char:WaitForChild("HumanoidRootPart")
repeat wait() until Hum.Health <= 0 -- wait until the player dies
RespawnPos = HRP.Position -- get the position of the Player's RootPart
wait(3) -- the time before the player respawns.
player:LoadCharacter() -- Respawn the character
Char:MoveTo(RespawnPos) -- Move the character to the position of where they died
So basically what this script should do, is get the your Character’s position when they die. And then manually spawn in your character, and then move your character to that position of where you died.
Put this LocalScript in StarterPlayers > StarterCharacterScripts and you should be good to go. Also make sure you disable the CharacterAutoLoads property in the Players game service, so that you can avoid your character respawning on its own.
Hope this helps!
(P.S. I have no idea if the script will work. but If it doesn’t work, then just reply or message me.)
Just make an function with an event OnDied()
Then make a variable where the position of the torso when the player dies then make another function onspawn() then use the variable of where the torso was last located.
Thanks for the script, but I checked used C_Sharper’s script and realized I disabled the script. XD sorry C_Sharper for wasting some of your time, but you earned 1 solution! Thanks!
edit: It worked, I forgot to say that.
Welcome to the dev forum!
Try the ways listed above ^^