I'm trying to make a level door system, I have the database all set up and working but my door is not working with the error in the title. Can anyone give me a hand? Thanks.
local DataStore2 = require(1936396537)
local player = game.Players.LocalPlayer.UserId
script.Parent.Touched:Connect(function()
local levelStore = DataStore2("Level", player)
if levelStore <= 1 then
script.Parent.CanCollide = false
end
end)
script.Parent.TouchEnded:Connect(function()
local levelStore = DataStore2("Level", player)
if levelStore <= 1 then
script.Parent.CanCollide = true
end
end)

2 comments
LocalPlayer does not exist on server since it does not know who you mean by local player
is it a local script? or a script?