How the heck I can make Dialog Hat Giver? I'm asking that, because there are only tutorials everywhere "How to make dialog tool/gun giver".
I think I'm the only one roblox player who ask for this. But maybe not?
1 answer
Put this script inside a Script inside your dialog and make a dialog choice named "Hat";
HatId = 1708345137 -- Change this to the Had Id that you want
script.Parent.DialogChoiceSelected:connect(function(Player,Choice)
if Choice.Name == "Hat" then
local Hat = game:GetService("InsertService"):LoadAsset(HatId)
Hat:GetChildren()[1].Parent = Player.Character
Hat:Destroy()
end
end)
How it works:
So first of all, this event activates when the player chooses a dialog choice. Then we check if the choice's name is "Hat". And if the player chooses "Hat" then the script will active. I used InsertService to insert the Hat by it's AssetId. But with InsertService it inserts the item inside a model. So since the Hat is inside a model, our "Hat" variable is equal to the model right now. So we just need what is inside the model, which is the hat. So we do GetChildren(). That function returns a table of all children inside our model.To get the hat inside the model we would use GetChildren()[1]. And now we set the the first child's (the hat) parent to the Player's character. And lastly, since we don't need the model anymore we just destroy is with Hat:Destroy().
Now if you have a hat in your game you want to give to the Player do this: (Make sure the Hat's Handle is not anchored!)
Hat = game.Workspace.Hat -- Set this to the hat object
script.Parent.DialogChoiceSelected:connect(function(Player,Choice)
if Choice.Name == "Hat" then
Hat:Clone().Parent = Player.Character
end
end)
15 comments
Ok im going to test that in roblox studio.
Sorry about the unnecessary print. I was using it for debugging
Ok now question. Can I put that script inside Dialog Choice?
ok nevermind I noticed now that you said that.
Yes you can. But I would not recommend it. Because there is no event for checking if a specific choice got selected. https://wiki.roblox.com/index.php?title=API:Class/DialogChoice
OMG It worked! Thank you so much!!! :D
No problem!
Ok, but I normally created the script inside "Dialog" not "DialogChoice".
Wait I noticed that I also maded an retextured beret. What I need to do if it's not a real hat?
Wait, maybe I need to put the model id.
No it didn't worked.
Ok It worked! Thank you so much and have a nice day! Also can I put in my game your name and say that you helped me with scripting? (I will make a gui.)
Sure, if you want! :)
Oh and don't forget to accept my answer, gotta get them reps :P
Ok, now bye!
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
I'm waiting for answers...
People! Dont be scared! I'm making a game and I want to know how to make that dialog hat giver!!!
People will answer your post eventually, dont post comments for no reason.
For no reason? WHAT THE ***? For no reason? Then why nobody is answering me huh?
1 hour later... Still waiting for answers...
finally someone answered me! Thank you MRbraveDragon!