Profile Service :Get() Not Progressing the Script

I am trying to make an area unlock for a minigolf game where you have to beat the hole to progress. I used profile service to save the hole and door you’ve opened so it saves. But the problem is the :Get() I’m using to check if the player has beat the level stops the script and the print doesn’t print. Can anybody help?

Server script inside proximity prompt:

local door = script.Parent.Parent.Parent
local PlayerDataHandler = require(game.ServerScriptService:WaitForChild("PlayerDataHandler"))

script.Parent.Triggered:Connect(function(player)
	PlayerDataHandler:Get(player, "Holes", function(currentHole)
		if table.find(currentHole, "Hole1") == nil then
			--Error Popup
		else
			PlayerDataHandler:Get(player, "Doors", function(openedDoor)
				if table.find(openedDoor, "Door 1") == nil then
					table.insert(openedDoor, "Door1")
					return openedDoor
				end
				
			end)
			print("firing event")
			game.ReplicatedStorage.UnlockDoor:FireClient(player, door)
			print(PlayerDataHandler:Get(player, "Doors"))
			
		end
	end)
end)

Local script in character scripts:

--local player = game.Players.LocalPlayer

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3,Enum.EasingStyle.Linear)

local goal = {}
goal.Transparency = 1

wait(0.5)


game.ReplicatedStorage.UnlockDoor.OnClientEvent:Connect(function(player, door)
	local fade = tweenService:Create(door,tweenInfo,goal)
	local fade2 = tweenService:Create(door.Image.Decal,tweenInfo,goal)

	for _, v in ipairs(door.Particles:GetChildren()) do
		v.Enabled = true
	end

	game.Workspace.Sounds.Victory:Play()
	game.Workspace.Sounds.OpenDoor:Play()

	fade:Play()

	wait(1.5)

	for _, v in ipairs(door.Particles:GetChildren()) do
		v.Enabled = false
	end

	wait(1.5)

	door.CanCollide = false

	door:Destroy()
end)

Thank you! Please note that the saving works, and it’s just the door opening that doesn’t.

1 Like

Shouldn’t you be using update accessing the data that way?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.