Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a stud log? Ex: (Player1 [5 studs] killed Player2)

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!

3 comments

0

This is not a request site. Please look at the community guidelines before posting a question: https://scriptinghelpers.org/help/community-guidelines

0

i- didnt make a request...

0

I see you edited your post. Previously, you mentioned us giving you a GUI and telling you where to put it, which is literally a request. I understand that you realized you made a mistake and tried to fix it, which is good, although that doesn't mean you never made the mistake.

1 answer

@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.

1 comment

0

imagine if my username on roblox was "Part" lmao

This discussion is preserved as it was. New answers, comments, and votes are closed.