Trying to fix an error I've been getting with onTouched and I get a new error.
Suggestions?
local Player = game.Players.LocalPlayer
local mouse = script.Parent.Parent:GetMouse()
local char = Player.Character or Player.CharacterAdded:Wait()
function onKeyPress(key)
key = key:lower()
if key == "r" then
local RSW = game.Lighting.RMOVE.RSW:Clone()
RSW.Parent = game.Workspace
RSW.Transparency = 1
wait(0.6)
RSW.Anchored = true
RSW.Transparency = 0
function onTouch(hit) -- <<------
RSW.Color = hit.Parent.Color
end
mouse.KeyPress:connect(onKeyPress)
char.Touched:connect(onTouch)
What I'm trying to do is change the color of RSW to whatever color your character is standing on. E.g. You stand on a grey floor so RSW will be grey, then you walk over to a green floor so RSW will be green, hope you're following.
Any advice is advice so I appreciate it nonetheless.

1 comment
This was a really helpful answer! Thanks!