Help with Scripting Argument

How do you predefine water then?

like how do you change the texture to the water, wherever your doing that just also change its parent to the folder

this should be somewhat Right, right?

white means its within the predefined distance and black means dont render.

the code goes in starterplayerscripts and its local

code:

wait(.5)

local plr = game.Players.LocalPlayer
local char = plr.Character

local cam = workspace.CurrentCamera

local waterFolder = workspace.waterParts

local run = game:GetService("RunService")

local maxDist = 45

run.RenderStepped:Connect(function(dt)
	
	for indexNum, waterPart in pairs(waterFolder:GetChildren()) do
		local waterPosition = waterPart.Position
		local camPosition = cam.CFrame.Position
		
		local distance = (camPosition - waterPosition).Magnitude
		
		if distance > maxDist then
			waterPart.Color = Color3.new(0, 0, 0)
		else
			waterPart.Color = Color3.new(1, 1, 1)
		end
	end
end)
1 Like

I don’t Predefine anything. it literally just takes Premade Chunk Models and Random Rotates them. So it generates the chunk “Pond” and the chunk “trees”.

image

I can make Rarity by having more Tree Chunks than Pond Chunks.

sorry to ask this but can I get the generation script so I can just change the code

or even just the part that puts it in the workspace??

1 Like

I will DM it.

(charrrrrrssssssss)

1 Like

Not “while true do”, put “if value then”

I’m guessing that you want to access the value, so use the one I mentioned above

local value = script.Value.Value -- odd variable name
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait() -- loading pause
local playerPos = workspace.player:WaitForChild("Head").Position -- really sure
local water = script.Parent.Position
local position = (water - playerPos).Magnitude

if position > 15 then
	value.Value = true
else value.Value = false
end

You have a few bad practices going on here and need to check if things are working correctly before moving on with the script.

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