what im confused about is that its located in player and i can see it there, i changed the code alot and it only errors here
the code is below:
local part = script.Parent
local db = false
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if player.leaderstats ~= nil then
if player.leaderstats.Fish.Value >= 10 then
hit.Parent:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.SpaceTele.CFrame
end
end
end)
leaderstats may be parented to a player but the code is saying you’re referencing [nil].leaderstats which means your variable player is nil, not the leaderstats. Check that player exists first, there may be an issue that GetPlayerFromCharacter() is returning nil for hit.Parent. This may happen if part touches something that doesn’t belong to a character, in which case you’d want to escape the function with something like: if not player then return end
after your local player = ... line.