StarterPlayerScripts内のlocalscript
local character = game.Workspace["15dialog"].Jukusenden:WaitForChild("Head")
local choice1 = character:WaitForChild("Dialog")
local function selected(player,choice)
if choice.Name == "Choice2_atsuine" then
game.ReplicatedStorage.Shioame:FireServer()
print("暑い!!!")
end
end
choice1.DialogChoiceSelected:Connect(selected)
ServerScriptService内のスクリプト
local function shioame(player)
if player.Character then
local Humanoido = player.Character:WaitForChild("Humanoid")
if Humanoido then
local shioameageru = game.ServerStorage["熱中症予防塩飴"]:Clone()
shioameageru.Parent = player.Backpack
end
end
end
game.ReplicatedStorage.Shioame.OnServerEvent:Connect(shioame)