Creating a.. tongue for the player..?

Ahaha don’t ask XXD

createTongue.OnServerEvent:Connect(function(player)
	local tongue = Instance.new('Part')
	tongue.BrickColor = BrickColor.new('Pink')
	tongue.Material = 'SmoothPlastic'
	tongue.Name = 'Tongue'
	tongue.Position = player.Character.Head.Position
	tongue.Size = Vector3.new(0.5, 0.25, 0.5)
	
	local mesh = Instance.new('SpecialMesh')
	mesh.MeshType = 'Sphere'
	
	local weld = Instance.new('Weld')
	weld.Parent = tongue
	weld.Part0 = tongue
	weld.Part1 = player.Character.Head
	
	mesh.Parent = tongue
	tongue.Parent = player.Character.Head
end)

Basically wanting to create like taunts for my game, and one being the player sticking out their tongue. So just messing around with this, it creates the part, I’m guessing inside the players head, not entirely sure where it’s spawning in but yea. Not sure how to get it to be in the right spot of the players face tho

Because of the issue of players having different faces, when they join the game you could change their face to a generic smiling one and then just hard-code the positions relative to the character

1 Like

Like @RedDuck765 said, there is too big of a variety across all the different faces on Roblox, so your best option would be limiting players to a few faces, or only one.

Currently your code is just putting the position at the head, hence:

tongue.Position = player.Character.Head.Position

So playing with that is gonna be the thing to yield some results.

Yea, just messing with it now

tongue.Position = player.Character.Head.Position + Vector3.new(5, 0, 0)

Using 5 as an extravagant number just so I can try to see it outside the head, and then can lower it and get it closer to the head. However even with this number, I cant see it

Are you sure it’s spawning?
Toss a print in first to see if it’s spawning in or not.

Yeah it is def spawning in, I’m more worried about the weld, never really done welds from within scripts

1 Like

Can’t say I’ve done a whole lot of welding like you are doing. Try making the part anchored, because then you’ll see if it’s spawning, and then possibly it had been falling off before finishing welding or something of that nature?

Ok yea that seems to work. It is spawning in, to the right of the player, easy fix. Only problem now though is the character can’t move. Thought since I’ve put the weld in the part before the part was parented to the head it wouldn’t be able to fall through

function create(player)
	local tongue = Instance.new('Part')
	tongue.BrickColor = BrickColor.new('Pink')
	tongue.Material = 'SmoothPlastic'
	tongue.Anchored = true
	tongue.Name = 'Tongue'
	tongue.Position = player.Character.Head.Position + Vector3.new(0, 0, 0)
	tongue.Size = Vector3.new(0.5, 0.25, 0.5)
	
	local mesh = Instance.new('SpecialMesh')
	mesh.MeshType = 'Sphere'
	
	local weld = Instance.new('Weld')
	weld.Parent = tongue
	weld.Part0 = tongue
	weld.Part1 = player.Character.Head
	
	mesh.Parent = tongue
	tongue.Parent = player.Character.Head
end

Even just setting it to inside the players head as well, it spawns in behind the player

With the following code:

createTongue.OnServerEvent:Connect(function(player)
	local tongue = Instance.new('Part')
	tongue.BrickColor = BrickColor.new('Pink')
	tongue.Material = 'SmoothPlastic'
	tongue.Name = 'Tongue'
	tongue.Anchored = true
	tongue.Position = player.Character.Head.Position
	tongue.Position = tongue.Position + Vector3.new(0, 0, 5)
	tongue.Size = Vector3.new(0.5, 0.25, 0.5)

	local mesh = Instance.new('SpecialMesh')
	mesh.MeshType = 'Sphere'

	local weld = Instance.new('Weld')
	weld.Parent = tongue
	weld.Part0 = tongue
	weld.Part1 = player.Character.Head
	
	tongue.Anchored = false
	
	mesh.Parent = tongue
	tongue.Parent = player.Character.Head
end)

Whereas with this code, not unanchoring it:

createTongue.OnServerEvent:Connect(function(player)
	local tongue = Instance.new('Part')
	tongue.BrickColor = BrickColor.new('Pink')
	tongue.Material = 'SmoothPlastic'
	tongue.Name = 'Tongue'
	tongue.Anchored = true
	tongue.Position = player.Character.Head.Position
	tongue.Position = tongue.Position + Vector3.new(0, 0, 5)
	tongue.Size = Vector3.new(0.5, 0.25, 0.5)

	local mesh = Instance.new('SpecialMesh')
	mesh.MeshType = 'Sphere'

	local weld = Instance.new('Weld')
	weld.Parent = tongue
	weld.Part0 = tongue
	weld.Part1 = player.Character.Head
	
	mesh.Parent = tongue
	tongue.Parent = player.Character.Head
end)

So, I’m guessing the weld is over-writing the position possibly?

Edit:
Yes, because we weren’t setting the C0 & C1 of the Weld to offset the part.
https://developer.roblox.com/articles/Weld

1 Like

If you are giving players a tongue, unless you are enforcing default roblox heads you might want to make the tongue big and cartoony, as heads can range from this: image
to this
image
and a small tongue would be stuck inside of or float in front of many heads

in terms of scripting, my team had an issue with welds that was fixed when we enabled one of the new options for welds in workspace, i don’t know if that would help at all though

local weld = Instance.new('Weld')
weld.Parent = tongue
weld.Part0 = tongue
weld.Part1 = player.Character.Head
weld.C0 = tongue.Position
weld.C1 = player.Character.Head + Vector3.new(0, 0, 10)

This seemingly does nothing :confused:

2 Likes

local createTongue = game.ReplicatedStorage:WaitForChild("TongueEvent")

createTongue.OnServerEvent:Connect(function(player)
	local tongue = Instance.new('Part')
	tongue.BrickColor = BrickColor.new('Pink')
	tongue.Material = 'SmoothPlastic'
	tongue.Name = 'Tongue'
	tongue.Position = player.Character.Head.Position
	tongue.Position = tongue.Position + Vector3.new(0, -4.25, .75)
	tongue.Size = Vector3.new(0.5, 0.25, 0.5)

	local mesh = Instance.new('SpecialMesh')
	mesh.MeshType = 'Sphere'

	local weld = Instance.new('Weld')
	weld.Parent = tongue
	weld.Part0 = tongue
	weld.Part1 = player.Character.Head
	weld.C0 = tongue.CFrame
	
	
	mesh.Parent = tongue
	tongue.Parent = player.Character.Head
end)

To move around the tongue, the further negative you go on the middle position number (in the script, it’s -4.25) the higher is goes into the air. So -5 is like closer to the forehead. The larger the last number is, the further forward it goes. (Currently .75, but if you make it 1, it’ll be out infront of the head)

I just tuned it to my helmet, but obviously a face will be different placement.

1 Like

Wait. No. Oof lol.
So, I didn’t move from spawn, and the tongue was fine. If you move from spawn and start mass clicking to spawn them, this happens. (I had BrickColor set to BrickColor.Random)

Still figuring out Welds and what not as I’m helping you, so yea, made a mistake along the way somewhere.

Just testing now, and it’s acting treally weird. Firstly it spawns at around my hips, and just saw the previous post and ye was gonna mention that. Seemingly gets further and further away from the player when you move around

1 Like

Okay, now this one works when you’re moving around lol.
To change position, change the numbers in the CFrame area of the C0.

createTongue.OnServerEvent:Connect(function(player)
	local tongue = Instance.new('Part')
	tongue.BrickColor = BrickColor.new('Pink')
	tongue.Material = 'SmoothPlastic'
	tongue.Name = 'Tongue'
	tongue.Position = player.Character.Head.Position
	tongue.Size = Vector3.new(0.5, 0.25, 0.5)

	local mesh = Instance.new('SpecialMesh')
	mesh.MeshType = 'Sphere'

	local weld = Instance.new('Weld')
	weld.Parent = tongue
	weld.Part0 = tongue
	weld.Part1 = player.Character.Head
	weld.C0 = CFrame.new(0, .25, -.75)*CFrame.fromEulerAnglesXYZ(0, math.pi, 0) --- Change the CFrame.new numbers for placement, and CFrame.fromEulerAngleXYZ for rotations
	
	
	mesh.Parent = tongue
	tongue.Parent = player.Character.Head
end)

2 Likes

Works like a charm :smiley: :smiley: thank you good sir :smiley: :smiley:

1 Like

Thank you, it was a process to get there, but I’ve learned a bit about Welds along the way. :slight_smile:

Also, added bonus

createTongue.OnServerEvent:Connect(function(player)
	local tongue = Instance.new('Part')
	tongue.BrickColor = BrickColor.new("Hot pink")
	tongue.Material = 'SmoothPlastic'
	tongue.Name = 'Tongue'
	tongue.Position = player.Character.Head.Position
	tongue.Size = Vector3.new(0.333, 0.15, 0.75)

	local mesh = Instance.new('SpecialMesh')
	mesh.MeshType = 'Sphere'

	local weld = Instance.new('Weld')
	weld.Parent = tongue
	weld.Part0 = tongue
	weld.Part1 = player.Character.Head
	weld.C0 = CFrame.new(0, -.15, -.65)*CFrame.fromEulerAnglesXYZ(-math.pi/5, math.pi, 0)
	
	
	mesh.Parent = tongue
	tongue.Parent = player.Character.Head
end)

Kiss Rock Tongue lol
image

1 Like