What do you want to achieve? A building system highlighting of the current placement position
What is the issue? Its not setting the part transparency
local mouse = game:GetService('Players').LocalPlayer:GetMouse()
local uis = game:GetService('UserInputService')
local hoveringOver = nil
local lastTransparency = nil
uis.InputBegan:Connect(function(input,gameProcessed)
if gameProcessed then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
if not hoveringOver then return end
if hoveringOver.Parent.Name == 'Normal' then
print("Normal")
elseif hoveringOver.Parent.Name == 'Sniper' then
print('Sniper')
end
end
end)
while wait() do
hoveringOver = mouse.Target
if hoveringOver then
if hoveringOver:FindFirstChild('isBuildPos') then
if hoveringOver:FindFirstChild('isBuildPos').Value then
lastTransparency = hoveringOver
hoveringOver.Transparency = 0.8
end
end
end
if lastTransparency then lastTransparency.Transparency = 1 end
end
The only thing I can think of that will make the script not work is if the character isnāt loaded in. I can test this right now and Iām positive it will work. Let me do a small test on studio right now.