I have a system where you claim a plot and progress through the game etc. but the problem is the plot won’t be claimed after you talk to the NPC. It does claim when you don’t talk to the NPC though. No errors
Here’s the part of my script that controls talking to the NPC:
local Prompt = TutorialGuy:WaitForChild("TutorialGuy"):WaitForChild("ProximityPrompt")
local DialogueMod = require(game:WaitForChild("ReplicatedStorage"):WaitForChild("DialogueModule"))
Prompt.Triggered:Connect(function(plr)
local CurrentData = GameData:GetAsync(Player.UserId .. "GameData") --GameData is the DataStore for my game
if plr == Player then
if CurrentData["DidTutorial"] == false then
DialogueMod:Start(plr, "DaBoy", Prompt.Parent.Parent:WaitForChild("Focus"), {"Hello there!", "I am the Floating Head, and I am here to guide you.", "To start this game, you must first claim a plot.", "After that, you have multiple tools to create any accessory you like.", "When you are done making your accessory, you can save it and add it to your store, where people can buy it for coins or robux.", "Mind you, it costs 100 coins to add an accessory to your store.", "Here, I'll give you 500 coins.", "Now, good luck on your accessories!"}, true, 15, Prompt, "Tutorial")
CurrentData["DidTutorial"] = true
PointToTutorial:FireClient(Player, false)
DialogueMod.Ended:Connect(function(player, key)
print("Received on server")
if player == plr then
print("Went through stage 1")
print(player)
print(key)
if key == "Tutorial" then
print("Went through stage 2")
CurrentData["Coins"] = CurrentData["Coins"] + 500
GameData:SetAsync(Player.UserId .. "GameData", CurrentData)
local UpdateCoinUI = ServToPlr:WaitForChild("UpdateCoins")
UpdateCoinUI:FireClient(plr, CurrentData["Coins"])
print("Updated UI")
end
end
end)
else
DialogueMod:Start(plr, "DaBoy", Prompt.Parent.Parent:WaitForChild("Focus"), {"FillerText", "MoreFillerText", "EVENMOREFILLERTEXT"}, true, 15, Prompt, "regular")
end
end
end)
And here’s the script that checks when the prompt is triggered (Doesn’t print “Triggered” if plot is claimed after tutorial)
local PlotVal = script.Parent:WaitForChild("PlotVal")
local Players = game:GetService("Players")
local ServStor = game:GetService("ServerStorage")
local Events = ServStor:WaitForChild("Misc"):WaitForChild("Events")
local Prompt = script.Parent
local Plot = Prompt.Parent
local Owner
Prompt.Triggered:Connect(function(plr)
print("Triggered")
Owner = plr
Prompt.Parent = game:GetService("ServerStorage")
local Claim = Events:WaitForChild("ClaimPlot")
Claim:Fire(PlotVal.Value, plr)
print("After fire code fired")
end)
Players.PlayerRemoving:Connect(function(plr)
if plr == Owner then
Owner = nil
Prompt.Parent = Plot
end
end)
I have a game file if you want the entire game:
Make And Wear.rbxl (91.6 KB)
If you need anything else let me know. Thanks