#attempt to index nil with wait for child
1 messages · Page 1 of 1 (latest)
do you have a pic of the script. It could help
'v'
"v"
'v'
''v''
v
v
what the um thingy for code
v
nvm
local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local HRP = char:WaitForChild("HumanoidRootPart") local startPosition = workspace:WaitForChild("start").Position local endPosition = workspace:WaitForChild("End").Position
the error is the last part (local endPosition = bla bla) @fleet slate
Make sure "workspace.End" exist
it does
I've been on this for the past hour
it exists before i press play, when i press play it disappears
and am not destroying it or changing the parent at all, am literally only using the part for the position
and its not falling out of the world cuz its anchored
I would try seeing if getting the position after would help
wym
After you wait for the part
oh
lemme try
doesnt work
but ig it wont cuz the part doesnt exist when i hit play
it works fine for start position, but not end position?
???
What if u copy startPosition block and replace the endPosition
To make sure their exactly the same
Also what happens when you click "Run"
am not clicking "run" and clicking play
Well if u click run does it dissapear
but it does when i click play
is there any other references to these parts in other scripts
skip to the end dev product
all of a sudden when i buy the dev product everything starts working?
.
😨
bro i want to fling my computer out the window rn, nothing makes sense
I'm not sure i'm following. Indexing nil means it does not exist and has no parent, so something has to be wrong. If it's a local script wouldn't hurt to but a task.wait(2) at the top
k lemme try
it exists on the server and not the client
how does that even make sense
i didnt instance it
a wild guess here, but if streaming enabled is on, and the parts are super far away from your spawn, then on the client those parts don't exist yet
hm
i think thats the issue
cuz the end part is like 1300 studs away from spawn
how do i turn off streaming enabled
try bringing it next to the spawn, test to see if it errors and if it does, click on workspace and turn streaming enabled off
i mean if it doesnt error*
I didn't think :WaitForChild() would throw an error if the part doesn't exist
At worst would warn "Infinite Yeild Possible"
I usually get an infinite yield warning as well ye
np glad it works
btw... whats streaming enabled?
Streaming Enabled is so dumb sometimes
streaming enabled is dumb yeah, but it's for slower devices to load in places as they get closer
so if i turn it off, is that a bad thing for my game?
unless you have a super massive game with high poly count buildings/items, then no it'll be fine
ok nice
^
no problem
I learn more and more about Streaming Enabled from issues than anything else 😨
is the other place an asset in the game?
u mean like apart of the game?
like you created it in asset manager
yh
well it will always be public as long as the main game is public, but you'll need to use teleportservice for players to enterit
oh, when i try to teleport it says restricted access
on roblox
`local TeleportService = game:GetService("TeleportService")
local SafeTeleport = require(game:GetService("ServerScriptService").SafeTeleport)
telePart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local char = hit.Parent
local placeId = 16868752131
local players = {game.Players:GetPlayerFromCharacter(hit.Parent)}
local server = TeleportService:ReserveServer(placeId)
local options = Instance.new("TeleportOptions")
options.ReservedServerAccessCode = server
SafeTeleport(placeId,players,options)
print("finished teleport")
end
end)
`
the placeId is from your asset manager right?
yh
I haven't made a game in a minute, but let me check out one of mine that uses teleport
mk