I am getting a Index Error.
and the RunContext is Legacy!
The character might be spawned after the script runs
This is caused by the way your getting the player
Nevermind you are getting the local player and this is client sided, change run context to client (sorry for some misunderstandings)
Oh, I didnt see that, yes that can NOT be ran on the server.
do i still do this?
or do i keep the current script and just change the RunContext?
I donât personally know because I dont use scripts in parts that are in the workspace very often.?
also If youâre doing render distance get the cameras position not the heads.
Ok. So. I feel like it would help if you knew WHAT I am making.
Would it help?
Do that to prevent potential errors when playerâs character is added later. By the way is there a way to reset your character as the character will be replaced with a new one. If there is then you can do this to refresh the player (the code must be before the while true do loop):
player.CharacterAdded:Connect(function(char)
character = char
end)
If you want the script to update playerPosition every time then use this (must be before while loop as well):
game:GetService("RunService").Heartbeat:Connect(function()
playerPos = character.Head.Position
position = (water - playerPos).Magnitude
end)
Yes.
(char limtitmti23123123ttititm)
so My first idea would be putting each water part into a folder then just for looping through the folders children so
code:
local waterPartsFolder = workspace.folderHere
for indexNum, waterPart in pairs(waterPartsFolder:GetChildren()) do
end
im sorry give me a minute im on a school laptop right now and i need to get on my personal computer.
Its totally fine! take as long as you need! Im in no rush!
So stick this in StarterCharacter or StarterPlayer?
in starterCharacter it would restart every time the player dies
however in starterPlayer it doesnt
The Map is Randomly Generated though. so would this still work?
even though its randomly generated, yes it should. because somewhere in the code it makes it water, and where that happens you would change the parent from workspace to the folder
The Generation code doesnt do ANYTHING with water.
It uses Cframes to Place models that are stored in ServerStorage in a grid, and it randomly rotates them. I modified it to change the Cframe on the Y axis, to give it a terrain look.