-
What do you want to achieve? Keep it simple and clear!
I want to try and achieve like the iron man mask effect with this helmet if you press “E” on your keyboard; it’s meant to go up; when you press it again it goes down. -
What is the issue? Include screenshots / videos if possible!
The issue is whenever I move the glass screen goes in a different direction and doesn’t go up or down; like it’s meant to do. - What solutions have you tried so far? Did you look for solutions on the Developer Hub? - I’ve tried parenting the helmet in the players head it does the same effect; I’ve tried searching around on the hub but couldn’t find anything to help.
local player = script.Parent.Parent.Parent.Character
local isGlassScreenModified = false
local isHelmetOn = false
local function tweenGlassScreen(endSize, endPosition)
local TweenService = game:GetService("TweenService")
local glassScreen = player.Helmet.GlassScreen
local initialPosition = glassScreen.Position
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = TweenService:Create(glassScreen, tweenInfo, { Size = endSize, Position = endPosition })
glassScreen.Position = initialPosition
player.Humanoid:LoadAnimation(script.HelmetAttract):Play()
wait(0.3)
glassScreen.ButtonSFX:Play()
wait(0.2)
tween:Play()
glassScreen.MachineSFX:Play()
wait(0.7)
glassScreen.MachineSFX:Stop()
isGlassScreenModified = not isGlassScreenModified
end
local function toggleHelmet()
local endSize, endPosition
if isHelmetOn then
endSize = Vector3.new(1.481, 0.737, 0.839)
endPosition = player.Helmet.GlassScreen.Position - Vector3.new(0.12, 0.26, -0.2173)
else
endSize = Vector3.new(1.481, 0.111, 0.839)
endPosition = player.Helmet.GlassScreen.Position + Vector3.new(0.12, 0.26, -0.2173)
end
tweenGlassScreen(endSize, endPosition)
isHelmetOn = not isHelmetOn
print(isHelmetOn and "Helmet turned on" or "Helmet turned off")
end
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.E then
toggleHelmet()
end
end)
Video Link
As shown in the video it goes up (slight position issue) and then it goes down to the default position but once I move my character like in a circle or something it just offsets idk why.