I have 2 areas in a game, and I need the same TERRAIN material grass color in one area to be green and white in another area. How do I do this? This script changes terrain color for the local player.
game.Workspace.Terrain:SetMaterialColor(Enum.Material.Grass, Color3.fromRGB(255,255,255))
To get it to work in a specific area, I disable that script, and made a part in the area with the fallowing script but the grass color is changed without touching the part.
function onTouched(hit)
game.StarterPlayer.StarterPlayerScripts.WhiteGrassScript.Enabled=true
end
script.Parent.Touched:Connect(onTouched)
Then tried the fallowing from a youtube video which worked for them
function onTouched(hit)
local human = hit.Parent:FindFirstChild("UpperTorso")
local brick = script.Parent
local player = game.Players:FindFirstChild(hit.Parent.Name)
if (human ~=nil) then
player.StarterPlayer.StarterPlayerScripts.WhiteGrassScript.Enabled=true
end
end
script.Parent.Touched:Connect(onTouched)
But gives me error: StarterPlayer is not a valid member of Player "Players.AlienDanBlox"
What’s wrong?