Problem with damage hitsound

I’m a newb to Roblox Studio so forgive me if this fries your brain

I’m trying to make a sound be put into the Owner’s Playergui. The problem I’m facing is that it just isn’t working how its supposed to. I’ve tried “FindFirstChild:(Owner.value)” and “GetPlayerFromCharacter(Owner.Value)”. Neither of them worked so I’m wondering what I can do to fix this issue.

local hitTable = {}

function lava(part)
	local Players = game:GetService('Players')
	local player = part.Parent
	local Owner = script.Parent.Owner
	if player:FindFirstChild("Humanoid") ~= nil and player.Name ~= Owner.Value and not table.find(hitTable, player) then
		table.insert(hitTable, player)
		player.Humanoid.Health = player.Humanoid.Health - math.random(1,2)
		player.Humanoid.Gived.Value = Owner.Value 
		wait(.75)
		local Hitter = Players:FindFirstChild(script.Parent.Owner.Value)
		Hitter:Destroy()
		table.remove(hitTable, table.find(hitTable, player))
	end
end
script.Parent.Touched:connect(lava)

Not entirely sure what sort of setup youre using, but i one thing causing your code to not function might be the fact that it could be situated in a local script inside a part, thats further parented in the workspace. Normally local scripts CANNOT run in the workspace however theres still a chance this is not at all related to your issue.

Another thing is that im… not entirely sure what exactly youre trying to do even thought at the same time its very clear what youre doing…
If you’re just trying to get a sound instance inside the touched player’s gui then the process isnt entirely that hard.

Basically:

local Players = game:GetService("Players")

local Lava = script.Parent
local Sound = whatever sound idk

Lava.Touched:Connect(function(Part)
	local ParentOfPart = Part.Parent
	if ParentOfPart:FindFirstChildOfClass("Humanoid") then
		local PlayerHumanoid = ParentOfPart:FindFirstChildOfClass("Humanoid")
		
		PlayerHumanoid.Health = PlayerHumanoid.Health - math.random(1,2)
		local Player = Players:GetPlayerFromCharacter(ParentOfPart)
		local PlayerGui = Player.PlayerGui
		
		Sound.Parent = PlayerGui
		... Whatever else code you need here
	end
end)

This is kinda basically it for getting the player character.
You just get the Touched part and all you have to do is just check whenever or not its parent has a humanoid or not. After than its all doing whatever you want with said player character. Still i apologize if this isnt what you were exactly asking for but hope this helps!

You got what I’m trying to do reversed, you see, I’m trying to make the sound instance go into the owner of the projectile’s Playergui. Appreciate the help though.