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

weird glitch with player hat giver specific question?

ok so bsically i have a hat give on my game and it was working a month ago but my broter shut down my pc without me saving my progres so i had to remake the giver and now its not working anymore for some weird reason and i havent been scripting much lately so it could be im missing something idk but i doubt it cause im an expert scripter so it probalby is a glitch but i just want to make sure. hers my code

giver = workspace.club.givers.hatgivers.tophat
hat = workspace.hats.tophat

giver.Touched:Connect(function(hit)
	clone = hat:Clone()
	clone.Parent = hit.Head
end)

2 answers

The 'hit' parameter of the 'Touched' function references a touched part, not a model. You are trying to search for the head of a character through that touched part.

On line 7, simply do

clone.Parent = hit.Parent.Head

Put the hat in lighting and try something like this!

giver = workspace.club.givers.hatgivers.tophat
Lighting = game:GetService("Lighting")
Hat = Lighting.Hat

giver.Touched:Connect(function(hit)
    clone = hat:Clone()
    clone.Parent = hit.Head
end)

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