Hello! So I’m trying to make a Wizard NPC for my game Jawks! A ROBLXO Puzzle game, When the Player Picks the “I want the Potion!” then a potion will spawn!
Is This Possible?
Hello! So I’m trying to make a Wizard NPC for my game Jawks! A ROBLXO Puzzle game, When the Player Picks the “I want the Potion!” then a potion will spawn!
Is This Possible?
Yes it’s possible, you would do something like this:
local Dialog = yourpathtothedialog
Dialog.DialogChoiceSelected:Connect(function(Player,Choice)
if Choice.Name == “TheNameOfTheDialog” then
–give the potion to the player
end
end)
So something like this?
local SpeedPotion = game.ReplicatedStorage.SpeedPotion
local Dialog = script.Parent.Parent
Dialog.DialogChoiceSelected:Connect(function(Player,Choice)
if Choice.Name == "GivePotion" then
local SpeedPotionClone = SpeedPotion:Clone()
SpeedPotionClone.Name = "Speed Potion"
SpeedPotionClone.Parent = game.Workspace
SpeedPotionClone.Position = Vector3.new(-10.47, 27, -255.549)
else
if Choice.Name == "DontGivePotion" then
return
end
end
end)
Yes ,and make sure it is in a local script
Edit: also make sure the local script is in StarterPlayer.StarterPlayerScripts or else it won’t work
I made it a local script and everything but it didn’t work, the potion doesn’t generate into the world at all, and the script for some reason doesn’t work
have you placed the script into starterplayerscripts
Just Noticed your edit!
yes I have and re-made the path.
It works thanks B>
now the wizard can officially give players potions!
Yes, this is possible.
How I would go about this:
( You could also make an event, but I personally don’t know how to do this. )
As for the script that does stuff for when the bool value is true, you could make it:
Hope this helps. :>
Oh no! I was using the ROBLOX Dialog prompt and stuff! I know how to do this with UI anyway!
I know it’s been a year but along with the if Choice.Name == "GivePotion" then
you should put an and statement for if Choice.Name == "GivePotion" and Player == game.Players.LocalPlayer then
otherwise the event will fire if ANYONE in the server selects that dialog.
Thanks, but you could have also messaged me that.