I am working on a Sword Fighting Game and I need help adding a stud log.
i currently have no progress on this, i dont know if anyone can help me, but anything is appreciated!
what i mean by stud log, is that a player kills another player and it tells you the distance (studs) they were killed from, on a textLabel that is in a Frame.
i am a noob at scripting so give me as much information as possible. Thanks!
@phxntxsmic is right, you should attempt to do something before posting here. However, I kinda want to help you, so i am going to show you how to get the distance between one player and another. (you will have to code everything else, however.)
There is a thing called magnitude which is basically distance as far as I know. You could get the magnitude between two character's HumanoidRootPart, which I like to get with "Character.PrimaryPart":
local function GetDistance(plrOne, plrTwo) local characterOne = workspace:FindFirstChild(plrOne.Name) local characterTwo = workspace:FindFirstChild(plrTwo.Name) if not characterOne or not characterTwo then return end -- stops the function if there is no character for the players. I don't even know why I do this, I just like to. local distance = (characterOne.PrimaryPart.Position - characterTwo.PrimaryPart.Position).Magnitude return distance end -- if you want to get the distance, you get it anytime with this function. local playerDistance = GetDistance(Killer, Victim)
Keep in mind I haven't tested this, this is just a quick lesson.