✓ Accepted answer
I see that you are using:
script.Parent.Touched:connect(onTouched)
which tells me that the local script is inside the gem itself.
Local scripts only run in certain places, i.e. the player and character, so they won't run if you place them inside the gem.
To fix this, I would put the script inside either the StarterPlayerScripts or StarterCharacterScripts, then replace script.Parent with a workspace-relative reference to the part. For example, if your part was called Part and inside a model called Gem which is directly parented to the workspace, then it would be:
function onTouched(hit)
end
workspace.Gem.Part.Touched:connect(onTouched)
Additionally, hit will be the part that collided with the part that onTouched is connected to. In that case,
if hit == script.Parent then
print("Stupid")
end
will never do anything, since the part can't collide with itself. If you want to check if the player was what collided with the part, you can use game.Players:GetPlayerFromCharacter(), like this:
if game.Players:GetPlayerFromCharacter(hit.Parent) == game.Players.LocalPlayer then
Hopefully this helps.
1 comment
Actually the Gem is inside the part, but I'll give this a try.