I’ve never had a problem before with the studio Assistant until this past update, any script it tries to make will contain several spelling errors when naming variables, writing directories or functions causing several errors in the script.
-- Find the Arm part and its HingeConstraint
local arm = script.ParentArm
local hingeConstraint = arm and arm:FindFirstChild("HingeConstraint")
-- Find the DiagBox part and its ProximityPrompt
local diagBox = script.ParentDiagBox
local proximityPrompt = diagBox and diagBox:FindFirstChild("ProximityPrompt")
if hingeConstraint and proximity then
-- Function to change the target angle
local function setTargetAngle(angle)
hingeConstraintargetAngle = angle
end
-- Function to handle the angle change logic
local function changeAngle()
-- Set the target angle to 0 degrees
setTargetAngle(0)
task.wait(5)
-- Set the target angle back to 90
setTargetAngle(90)
end
-- Connect the proximity prompt activation event to the angle change logic
proximityPromptTriggered:Connect(function()
changeAngle()
end)
else
warn("HingeConstraint or ProximityPrompt not found")
end
Telling it it has a typo makes it change the script to this:
-- Find the Arm part and its HingeConstraint
local arm = script.Parent.Arm
local hingeConstraint = arm and arm:FindFirstChild("HingeConstraint")
-- Find the DiagBox part and its ProximityPrompt
local diagBox = script.Parent.DiagBox
local proximityPrompt = diagBox and diagBox:FindFirstChild("ProximityPrompt")
if hingeConstraint and proximityPrompt then
-- Function to change the target angle local function setTargetAngle(angle) hingeConstraint.TargetAngle = angle end -- Function to handle the angle change logic local function changeAngle() -- Set the target angle to 0 degrees setTargetAngle(0) task.wait(5)
-- Set the target angle back to 90 setTargetAngle(90) end -- Connect the proximity prompt activation event to the angle change logic proximityPrompt.Triggered:Connect(function() changeAngle() end)
else warn("HingeConstraint or ProximityPrompt not found")
end